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(perf): enable compile cache #7901

Merged
merged 1 commit into from
Nov 20, 2024
Merged

Conversation

H4ad
Copy link
Contributor

@H4ad H4ad commented Nov 10, 2024

Adding support to module.enableCompileCache, added by nodejs/node#54501, Typescript got 2.5x perf on tsc.

On my machine, for the command --version, I got the following results:

Benchmark 1: node bin/npm-cli.js --version
  Time (mean ± σ):      58.0 ms ±   1.1 ms    [User: 51.8 ms, System: 16.8 ms]
  Range (min … max):    56.5 ms …  62.6 ms    51 runs
 
Benchmark 2: node bin/npm-cli-with-cache.js --version
  Time (mean ± σ):      52.9 ms ±   1.0 ms    [User: 46.5 ms, System: 16.8 ms]
  Range (min … max):    51.4 ms …  55.5 ms    56 runs
 
Summary
  'node bin/npm-cli-with-cache.js --version' ran
    1.10 ± 0.03 times faster than 'node bin/npm-cli.js --version'

I run the same test with npm run empty and I got the same 10% improvement.

@H4ad H4ad requested a review from a team as a code owner November 10, 2024 02:07
lib/cli.js Outdated Show resolved Hide resolved
@H4ad H4ad force-pushed the perf/enable-compile-cache branch from af5e805 to 893e95e Compare November 20, 2024 21:49
@H4ad H4ad force-pushed the perf/enable-compile-cache branch from 893e95e to 7c77131 Compare November 20, 2024 22:12
@wraithgar
Copy link
Member

Thanks! If you want to duplicate this PR in the release/v10 branch it could go out w/ the imminent v10 release.

@H4ad
Copy link
Contributor Author

H4ad commented Nov 20, 2024

Sure, #7924

@wraithgar wraithgar merged commit e19bff0 into npm:latest Nov 20, 2024
19 checks passed
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.

2 participants