babel-plugin-espower
babel-plugin-espower copied to clipboard
Is estraverse necessary?
This is the first babel plugin I've seen that simply uses a Program
entrypoint then uses estraverse
all over (https://github.com/power-assert-js/babel-plugin-espower/blob/4932320d9eecffca0dc38dc7fc2684ffffca1c6c/lib/babel-assertion-visitor.js) rather than use the visitors provided by Babel itself.
This additional/redundant parsing makes estraverse
's functions the heaviest in a profile run of one test file, screenshotted below:
This leads to us finding estraverse
code at the bottom of a significant proportion of the flame graph:
How necessary is this module? Can the plugin be modified to follow babel conventions more closely?
Time with babel-plugin-espower enabled:
env BABEL_DISABLE_CACHE=1 time ./node_modules/.bin/mocha test/spec/fooSpec.js
...
11.28 real 13.31 user 1.03 sys
With it disabled:
env BABEL_DISABLE_CACHE=1 time ./node_modules/.bin/mocha test/spec/fooSpec.js
...
7.29 real 8.85 user 0.96 sys