perf(cli): enable compile cache and defer getCliVersion for serve (#5938)

Enable Node.js compile cache (module.enableCompileCache) in the serve
fast-path so V8 bytecode is cached across daemon restarts. Start
getCliVersion() as a non-blocking promise and resolve it in parallel
with the runtime module loads inside buildRuntime(), removing it from
the pre-listen critical path.
This commit is contained in:
jinye 2026-06-27 22:19:29 +08:00 committed by GitHub
parent 865581b559
commit a93ec674e9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 18 additions and 8 deletions

View file

@ -19,6 +19,7 @@
* independently add --expose-gc via spawnChannel.ts.
*/
import module from 'node:module';
import { spawnSync } from 'node:child_process';
import { fileURLToPath, pathToFileURL } from 'node:url';
import { dirname, join } from 'node:path';
@ -31,6 +32,7 @@ function isServeCommand() {
}
if (isServeCommand()) {
module.enableCompileCache?.();
process.argv[1] = cliPath;
await import(pathToFileURL(cliPath).href);
} else {