v8-compile-cache

Require hook for automatic V8 compile cache persistence

  • Owner: zertosh/v8-compile-cache
  • Platform:
  • License:: MIT License
  • Category::
  • Topic:
  • Like:
    0
      Compare:

Github stars Tracking Chart

v8-compile-cache

Build Status

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.

Usage

  1. Add the dependency:
$ npm install --save v8-compile-cache
  1. Then, in your entry module add:
require('v8-compile-cache');

Requiring 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 v8-compile-cache.

Options

Set the environment variable DISABLE_V8_COMPILE_CACHE=1 to disable the cache.

Internals

The caches are stored in $TMP/v8-compile-cache/V8_VERSION, where there are .BLOB and .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.

Benchmarks

See https://github.com/zertosh/v8-compile-cache/tree/master/bench.

Load Times:, Module, Without Cache, With Cache, ----------------, -------------:, ----------:, babel-core, 218ms, 185ms, yarn, 153ms, 113ms, yarn (bundled), 228ms, 105ms, ^ Includes the overhead of loading the cache itself.

Acknowledgements

Main metrics

Overview
Name With Ownerzertosh/v8-compile-cache
Primary LanguageJavaScript
Program languageJavaScript (Language Count: 2)
Platform
License:MIT License
所有者活动
Created At2017-02-21 20:56:26
Pushed At2023-12-12 10:22:39
Last Commit At2023-08-14 14:38:32
Release Count13
Last Release Namev2.4.0 (Posted on )
First Release Namev1.0.0 (Posted on 2017-02-21 20:12:51)
用户参与
Stargazers Count740
Watchers Count9
Fork Count41
Commits Count107
Has Issues Enabled
Issues Count23
Issue Open Count15
Pull Requests Count11
Pull Requests Open Count7
Pull Requests Close Count9
项目设置
Has Wiki Enabled
Is Archived
Is Fork
Is Locked
Is Mirror
Is Private