hughsk / envify

:wrench: Selectively replace Node-style environment variables with plain strings.
902 stars 57 forks source link

Use jstranform instead of recast (massive speedup) #5

Closed andreypopp closed 10 years ago

andreypopp commented 10 years ago

This gains us a massive speedup, envify w/ recast takes almost 7 secs on my MBA when browserifying React codebase. While envify w/ jstransform brings this down to 1.5 sec (pre-recast speed) and delivers the same advantages as recast transform (preserves code formatting).

andreypopp commented 10 years ago

See referenced React issue for numbers.

sophiebits commented 10 years ago

cc @benjamn

benjamn commented 10 years ago

I agree that recast is overkill here, since all envify needs is to replace expressions in place. Recast maintains more metadata about the AST in order to handle more complicated transformations, and that has a cost (that can be avoided here).

hughsk commented 10 years ago

@andreypopp that's an impressive speed boost, thanks for this! Published as envify@1.2.0 :)