Skip to content

Commit

Permalink
perf(cli): enable Node.js compile cache (#8331)
Browse files Browse the repository at this point in the history
* perf(cli): enable Node.js compile cache

* fix: no need for NODE_DISABLE_COMPILE_CACHE
  • Loading branch information
chenjiahan authored Nov 4, 2024
1 parent 10de7f9 commit b89df1d
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions packages/rspack-cli/bin/rspack.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,17 @@
#!/usr/bin/env node
const nodeModule = require("node:module");

// enable on-disk code caching of all modules loaded by Node.js
// requires Nodejs >= 22.8.0
const { enableCompileCache } = nodeModule;
if (enableCompileCache) {
try {
enableCompileCache();
} catch {
// ignore errors
}
}

const { RspackCLI } = require("../dist/index");

async function runCLI() {
Expand Down

2 comments on commit b89df1d

@rspack-bot
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📝 Ran ecosystem CI: Open

suite result
modernjs ❌ failure
_selftest ✅ success
rspress ✅ success
rslib ✅ success
rsbuild ❌ failure
examples ❌ failure
devserver ❌ failure

@rspack-bot
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📝 Benchmark detail: Open

Name Base (2024-11-04 a987332) Current Change
10000_big_production-mode + exec 45.9 s ± 613 ms 43.5 s ± 1.82 s -5.36 %
10000_development-mode + exec 1.84 s ± 17 ms 1.84 s ± 22 ms +0.28 %
10000_development-mode_hmr + exec 645 ms ± 12 ms 642 ms ± 5.8 ms -0.45 %
10000_production-mode + exec 2.4 s ± 19 ms 2.43 s ± 27 ms +1.18 %
arco-pro_development-mode + exec 1.79 s ± 63 ms 1.79 s ± 93 ms 0.00 %
arco-pro_development-mode_hmr + exec 429 ms ± 1.2 ms 430 ms ± 1.2 ms +0.39 %
arco-pro_production-mode + exec 3.19 s ± 87 ms 3.18 s ± 103 ms -0.14 %
arco-pro_production-mode_generate-package-json-webpack-plugin + exec 3.27 s ± 50 ms 3.28 s ± 46 ms +0.55 %
threejs_development-mode_10x + exec 1.58 s ± 7.7 ms 1.58 s ± 14 ms -0.14 %
threejs_development-mode_10x_hmr + exec 784 ms ± 4.2 ms 782 ms ± 12 ms -0.18 %
threejs_production-mode_10x + exec 4.93 s ± 40 ms 4.95 s ± 36 ms +0.34 %

Please sign in to comment.