v8-compile-cache attaches a
require hook to use V8's code cache to speed up instantiation time. The "code cache" is the work of parsing and compiling done by V8.
The ability to tap into V8 to produce/consume this cache was introduced in Node v5.7.0.
- Add the dependency:
$ npm install --save v8-compile-cache
- Then, in your entry module add:
v8-compile-cache in Node <5.7.0 is a noop – but you need at least Node 4.0.0 to support the ES2015 syntax used by
Set the environment variable
DISABLE_V8_COMPILE_CACHE=1 to disable the cache.
The caches are stored in
$TMP/v8-compile-cache/V8_VERSION, where there are
.MAP files corresponding to the entry module that required
v8-compile-cache. The cache is entry module specific because it is faster to load the entire code cache into memory at once, than it is to read it from disk on a file-by-file basis.
|Module||Without Cache||With Cache|
^ Includes the overhead of loading the cache itself.
NativeCompileCacheare based on Atom's implementation of their v8 compile cache:
mkdirpSyncis based on: