Use async fs instead of fs.*Sync calls
alippai opened this issue · 4 comments
0x, a cool tool by @davidmarkclements shows, that (for my build) fs.realpathSync
calls block the running for 15% of the total time.
https://github.com/rollup/rollup-plugin-node-resolve/blob/master/src/index.js#L209
https://github.com/rollup/rollup-plugin-node-resolve/blob/master/src/index.js#L210
Also we can use util.promisify for
https://github.com/rollup/rollup-plugin-node-resolve/blob/master/src/index.js#L13
https://github.com/rollup/rollup-plugin-node-resolve/blob/master/src/index.js#L14
Hello, I refactored this package with no sync methods. How I can bench refactored plugin?
Can be closed if PR will be merged.
A simple way of benchmarking is to run Rollup with the --perf option. Rollup's repo also has a script to automatically bundle a package several times and calculate averages. To do so, you would check out the main Rollup repo and run npm run perf:init <username>/<repo>#<branch>
. This will clone the repo into a "perf" directory. The repo itself should contain a rollup config, but you can manually add one. Alternatively you can create that folder or the rollup config manually. Then run "npm run perf"