Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Honor eager setting (false by default) #1179

Merged
merged 1 commit into from Sep 24, 2019

Conversation

coreyfarrell
Copy link
Member

@coreyfarrell coreyfarrell commented Sep 14, 2019

This delays loading of istanbul-lib-instrument until it is needed.


This fixes a performance regression caused by #985, adds tests to prevent in the future. To test you can create a script eager.js:

console.log(Object.keys(require.cache).length - 1); // don't count eager.js itself

Then you can test the effect of non-eager loading:

$ node eager.js
0
$ ./bin/nyc.js --silent --exclude=eager.js --eager=true node eager.js
293
$ ./bin/nyc.js --silent --exclude=eager.js node eager.js
143

Running under nyc with eager: true (or without this patch) results in 293 additional modules being loaded, this patch by default reduces the "always load" to 143. This is demonstrated here by ensuring that all sources are excluded from instrument but in practice large test suites that load sources from multiple processes would see benefit when caching-transform bypasses repeated instruments.

This delays loading of istanbul-lib-instrument until it is needed.
@coveralls
Copy link

Coverage Status

Coverage increased (+0.2%) to 98.715% when pulling 25730d5 on coreyfarrell:fix-eager into 03ba5b9 on istanbuljs:master.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants