luckymarmot/API-Flow

Improve Postman environment resolution

mittsh opened this issue · 2 comments

We have been using a char-by-char string parsing which may lead to a performance hit. As per this comment on PR #29:

What's the goal of this char-by-char string parsing? Why not simply a regexp to match {{env}}? /\{\{[^}]+\}\}/ would work nicely…
If this is to be able to resolve nested env variables, I'm concerned that we are trading a "nice to have" feature that is likely to not even be officially supported by Postman – and may not be even used by anyone (why on Earth would you nest environment variable names?!) – for a massive performance hit. Most JavaScript regexp engines are probably written in plain C, and is super efficient, doing this by hand here, on every single string we import, may be really slow…

Maybe should we keep this function around, as an alternative? And quickly make a simpler one (can be done in a few lines I think). It's also about code complexity, I wouldn't want to resolve bugs in this myself :)

Would be nice to look into this later, and see what can be done. I'm thinking of an option to resolve nested environment names, which would trigger this char-by-char stack based parsing instead of a simpler and more efficient regexp-based parser.

planned for v0.2

Code has been simplified with PR #59 and other PRs in general. This issue is not applicable to the current code base anymore