v22.1.0
版本发布时间: 2024-05-02 22:40:16
nodejs/node最新发布版本:v23.3.0(2024-11-21 07:00:59)
module: implement NODE_COMPILE_CACHE
for automatic on-disk code caching
This patch implements automatic on-disk code caching that can be enabled
via an environment variable NODE_COMPILE_CACHE=/path/to/cache/dir
.
When set, whenever Node.js compiles a CommonJS or a ECMAScript Module,
it will use on-disk V8 code cache
persisted in the specified directory
to speed up the compilation. This may slow down the first load of a
module graph, but subsequent loads of the same module graph may get
a significant speedup if the contents of the modules do not change.
Locally, this speeds up loading of test/fixtures/snapshot/typescript.js
from ~130ms to ~80ms.
To clean up the generated code cache, simply remove the directory.
It will be recreated the next time the same directory is used for
NODE_COMPILE_CACHE
.
Compilation cache generated by one version of Node.js may not be used by a different version of Node.js. Cache generated by different versions of Node.js will be stored separately if the same directory is used to persist the cache, so they can co-exist.
Caveat: currently when using this with V8 JavaScript code coverage, the coverage being collected by V8 may be less precise in functions that are deserialized from the code cache. It's recommended to turn this off when running tests to generate precise coverage.
Contributed by Joyee Cheung in #52535.
Other Notable Changes
- [
44ee04cf9f
] - buffer: improvebase64
andbase64url
performance (Yagiz Nizipli) #52428 - [
3c37ce5710
] - (SEMVER-MINOR) dns: add order option and support ipv6first (Paolo Insogna) #52492 - [
3026401be1
] - events,doc: mark CustomEvent as stable (Daeyeon Jeong) #52618 - [
64428dc1c9
] - (SEMVER-MINOR) lib, url: add awindows
option to path parsing (Aviv Keller) #52509 - [
d79ae74f71
] - (SEMVER-MINOR) net: add CLI option for autoSelectFamilyAttemptTimeout (Paolo Insogna) #52474 - [
43fa6a1a45
] - (SEMVER-MINOR) src: addstring_view
overload to snapshot FromBlob (Anna Henningsen) #52595 - [
c6fe433d42
] - src,permission: throw async errors on async APIs (Rafael Gonzaga) #52730 - [
e247a61d15
] - (SEMVER-MINOR) test_runner: add --test-skip-pattern cli option (Aviv Keller) #52529 - [
9b18df9dcb
] - (SEMVER-MINOR) url: implement parse method for safer URL parsing (Ali Hassan) #52280
Commits
- [
35643c18c0
] - benchmark: reduce the buffer size for blob (Debadree Chatterjee) #52548 - [
7cdfe8a3fc
] - benchmark: inherit stdio/stderr instead of pipe (Ali Hassan) #52456 - [
7b82c17f22
] - benchmark: add ipc support to spawn stdio config (Ali Hassan) #52456 - [
dfda6fed61
] - buffer: add missing ARG_TYPE(ArrayBuffer) for isUtf8 (Jungku Lee) #52477 - [
44ee04cf9f
] - buffer: improvebase64
andbase64url
performance (Yagiz Nizipli) #52428 - [
c64a1a3b89
] - build: fix typo in node.gyp (Michaël Zasso) #52719 - [
4f713fbc2e
] - build: fix headers install for shared mode on Win (Segev Finer) #52442 - [
4baeb7b21d
] - build: fix arm64 cross-compilation bug on non-arm machines (Mahdi Sharifi) #52559 - [
d5cd468ce8
] - build,tools,node-api: fix building node-api tests for Windows Debug (Vladimir Morozov) #52632 - [
910533fcfd
] - crypto: simplify assertions in Safe*Print (David Benjamin) #49709 - [
61e1ac0b8c
] - crypto: enable NODE_EXTRA_CA_CERTS with BoringSSL (Shelley Vohr) #52217 - [
6e98eee256
] - deps: upgrade npm to 10.7.0 (npm team) #52767 - [
27a5f9418c
] - deps: V8: cherry-pick 500de8bd371b (Richard Lau) #52676 - [
3b422ddcea
] - deps: update corepack to 0.28.0 (Node.js GitHub Bot) #52616 - [
d40e4d4c42
] - deps: update ada to 2.7.8 (Node.js GitHub Bot) #52517 - [
5b52a4870a
] - deps: update icu to 75.1 (Node.js GitHub Bot) #52573 - [
80cbe72c1f
] - deps: update undici to 6.13.0 (Node.js GitHub Bot) #52493 - [
9a44059055
] - deps: update zlib to 1.3.0.1-motley-7d77fb7 (Node.js GitHub Bot) #52516 - [
d67a9a5360
] - deps: update minimatch to 9.0.4 (Node.js GitHub Bot) #52524 - [
8738b89971
] - deps: upgrade npm to 10.5.2 (npm team) #52458 - [
8e4fd2842b
] - deps,src: simplify base64 encoding (Daniel Lemire) #52714 - [
3c37ce5710
] - (SEMVER-MINOR) dns: add order option and support ipv6first (Paolo Insogna) #52492 - [
3987a28a9e
] - doc: update process.versions properties (ishabi) #52736 - [
c0b58e07f1
] - doc: remove mold use on mac for speeding up build (Cong Zhang) #52252 - [
9a032cf6e2
] - doc: remove relative limitation to pm (Rafael Gonzaga) #52648 - [
90c6e77238
] - doc: fix info string causing duplicated code blocks (Mathieu Leenhardt) #52660 - [
4d577fa048
] - doc: add .gitattributes for md files (Hüseyin Açacak) #52161 - [
04c8e110e5
] - doc: run license-builder (github-actions[bot]) #52631 - [
3552829594
] - doc: add info on contributor spotlight program (Michael Dawson) #52598 - [
eeb80ad836
] - doc: correct unsafe URL example in http docs (Malte Legenhausen) #52555 - [
c83526a688
] - doc: replace U+00A0 with U+0020 (Luigi Pinca) #52590 - [
31831e9db8
] - doc: sort options alphabetically (Luigi Pinca) #52589 - [
a93f5d4aaa
] - doc: correct stream.finished changes (KaKa) #52551 - [
27ffa35540
] - doc: add RedYetiDev to triage team (Aviv Keller) #52556 - [
63cc2b870e
] - doc: fix issue detected in markdown lint update (Rich Trott) #52566 - [
7e93c4892b
] - doc: update test runner coverage limitations (Moshe Atlow) #52515 - [
3026401be1
] - events,doc: mark CustomEvent as stable (Daeyeon Jeong) #52618 - [
c6e0fe2f22
] - fs: allow setting Stat date properties (Nicolò Ribaudo) #52708 - [
f23fa1de72
] - fs: fix read / readSync positional offset types (Ruy Adorno) #52603 - [
a7e03d301a
] - fs: fixes recursive fs.watch crash on Linux when deleting files (Matteo Collina) #52349 - [
d5ecb6cd00
] - http2: fix excessive CPU usage when usingallowHTTP1=true
(Eugene) #52713 - [
d1adc9b140
] - lib: enforce ASCII order in error code imports (Antoine du Hamel) #52625 - [
9ffdcade37
] - lib: use predefined variable instead of bit operation (Deokjin Kim) #52580 - [
fdcde845ee
] - lib: refactor lazy loading of undici for fetch method (Victor Chen) #52275 - [
f6145aa2ca
] - lib: convert WeakMaps in cjs loader with private symbol properties (Chengzhong Wu) #52095 - [
014bf01efc
] - lib: replace string prototype usage with alternatives (Aviv Keller) #52440 - [
dc399ddd03
] - lib, doc: rename readme.md to README.md (Aviv Keller) #52471 - [
64428dc1c9
] - (SEMVER-MINOR) lib, url: add awindows
option to path parsing (Aviv Keller) #52509 - [
9b2b6abb62
] - lib,src: iterate module requests of a module wrap in JS (Chengzhong Wu) #52058 - [
896a80e366
] - meta: standardize regex (Aviv Keller) #52693 - [
20c07e922e
] - meta: move one or more collaborators to emeritus (Node.js GitHub Bot) #52633 - [
e70d8a4fa9
] - meta: move one or more collaborators to emeritus (Node.js GitHub Bot) #52457 - [
20ab8f2a88
] - module: support ESM detection in the CJS loader (Joyee Cheung) #52047 - [
544c602b75
] - module: skip NODE_COMPILE_CACHE when policy is enabled (Joyee Cheung) #52577 - [
3df3afc284
] - module: detect ESM syntax by trying to recompile as SourceTextModule (Joyee Cheung) #52413 - [
4d77fd2c46
] - (SEMVER-MINOR) module: implement NODE_COMPILE_CACHE for automatic on-disk code caching (Joyee Cheung) #52535 - [
9794d21b07
] - module: fix submodules loaded by require() and import() (Joyee Cheung) #52487 - [
b00766d9e7
] - module: tidy code and comments (Jacob Smith) #52437 - [
d79ae74f71
] - (SEMVER-MINOR) net: add CLI option for autoSelectFamilyAttemptTimeout (Paolo Insogna) #52474 - [
b17cfea289
] - node-api: address coverity report (Michael Dawson) #52584 - [
1fca8baac1
] - node-api: copy external type tags when they are set (Niels Martignène) #52426 - [
d086ab42a1
] - quic: address recent coverity warnings (Michael Dawson) #52647 - [
fb4edf70cf
] - quic: rework TLSContext, additional cleanups (James M Snell) #51340 - [
0c58d0319b
] - src: remove misplaced windows code under posix guard in node.cc (Ali Hassan) #52545 - [
e20d2f1de3
] - src: cast to v8::Value before using v8::EmbedderGraph::V8Node (Joyee Cheung) #52638 - [
43fa6a1a45
] - (SEMVER-MINOR) src: addstring_view
overload to snapshot FromBlob (Anna Henningsen) #52595 - [
a56faff4d0
] - src: parse inspector profiles with simdjson (Joyee Cheung) #51783 - [
ac04c6434a
] - src: remove regex usage for env file parsing (IlyasShabi) #52406 - [
f283d27285
] - src: fix loadEnvFile ENOENT error (mathis-west-1) #52438 - [
c6fe433d42
] - src,permission: throw async errors on async APIs (Rafael Gonzaga) #52730 - [
9f9eca965a
] - stream: update ongoing promise in async iterator return() method (Mattias Buelens) #52657 - [
d568a9a38e
] - test: marktest-error-serdes
as flaky (Antoine du Hamel) #52739 - [
45f7002b90
] - test: mark test as flaky (Michael Dawson) #52671 - [
10596e20e8
] - test: fix backtick usage in docs (Aviv Keller) #52643 - [
b2f754c9f1
] - test: skip test-fs-watch-recursive-delete.js on IBM i (Abdirahim Musse) #52645 - [
ed080d868d
] - test: ensure that all worker servers are ready (Luigi Pinca) #52563 - [
c8c61737e4
] - test: fix test-tls-ticket-cluster.js (Hüseyin Açacak) #52431 - [
18aa5d6640
] - test: split wasi poll test for windows (Hüseyin Açacak) #52538 - [
e34e0a9ba1
] - test: write tests for assertIsArray http2 util (Sinan Sonmez (Chaush)) #52511 - [
e247a61d15
] - (SEMVER-MINOR) test_runner: add --test-skip-pattern cli option (Aviv Keller) #52529 - [
e066ba2ae4
] - test_runner: better error handing for test hook (Alex Yang) #52401 - [
328755341d
] - test_runner: don't exceed call stack when filtering (Colin Ihrig) #52488 - [
b4ccb6c626
] - test_runner: move end of work check to finalize() (Colin Ihrig) #52488 - [
2ef9380472
] - tools: update lint-md-dependencies to rollup@4.17.0 (Node.js GitHub Bot) #52729 - [
db421bdefc
] - tools: take co-authors into account infind-inactive-collaborators
(Antoine du Hamel) #52669 - [
01103a85cb
] - tools: fix invalid escape sequence in mkssldef (Michaël Zasso) #52624 - [
382d951b01
] - tools: update lint-md-dependencies to rollup@4.15.0 (Node.js GitHub Bot) #52617 - [
f9ddd77ff3
] - tools: add lint rule to keep primordials in ASCII order (Antoine du Hamel) #52592 - [
552642a498
] - tools: update lint-md-dependencies (Rich Trott) #52581 - [
df61feb655
] - tools: fix heading spaces for osx-entitlements.plist (Jackson Tian) #52561 - [
6b4bbfbb1f
] - tools: update lint-md-dependencies to rollup@4.14.2 vfile-reporter@8.1.1 (Node.js GitHub Bot) #52518 - [
4e5ce3afb7
] - tools: use stylistic ESLint plugin for formatting (Michaël Zasso) #50714 - [
15c5686381
] - tools: update minimatch index path (Marco Ippolito) #52523 - [
8ae1507ae1
] - tools: add a linter for README lists (Antoine du Hamel) #52476 - [
0b970316bc
] - typings: fix invalid JSDoc declarations (Yagiz Nizipli) #52659 - [
9b18df9dcb
] - (SEMVER-MINOR) url: implement parse method for safer URL parsing (Ali Hassan) #52280 - [
d33131af3a
] - vm: fix ASCII-betical order (Aviv Keller) #52686