Big update!Introducing GitHub Bot Commands. Learn more
Socket
Log inBook a demo

v8-compile-cache-lib

Package Overview
Dependencies
0
Maintainers
1
Versions
2
Issues
File Explorer

Advanced tools

v8-compile-cache-lib

Require hook for automatic V8 compile cache persistence

    3.0.1latest

Version published
Maintainers
1
Weekly downloads
6,644,260
decreased by-17.22%

Weekly downloads

Readme

Source

v8-compile-cache-lib

Fork of v8-compile-cache exposed as an API for programmatic usage in other libraries and tools.


Build status

v8-compile-cache-lib 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-lib
  1. Then, in your entry module add:
require('v8-compile-cache-lib').install();

.install() 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-lib.

Options

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

Cache directory is defined by environment variable V8_COMPILE_CACHE_CACHE_DIR or defaults to <os.tmpdir()>/v8-compile-cache-<V8_VERSION>.

Internals

Cache files are suffixed .BLOB and .MAP corresponding to the entry module that required v8-compile-cache-lib. 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/cspotcode/v8-compile-cache-lib/tree/master/bench.

Load Times:

ModuleWithout CacheWith Cache
babel-core218ms185ms
yarn153ms113ms
yarn (bundled)228ms105ms

^ Includes the overhead of loading the cache itself.

Acknowledgements

FAQs

What is v8-compile-cache-lib?

Require hook for automatic V8 compile cache persistence

Is v8-compile-cache-lib popular?

The npm package v8-compile-cache-lib receives a total of 5,613,120 weekly downloads. As such, v8-compile-cache-lib popularity was classified as popular.

Is v8-compile-cache-lib well maintained?

We found that v8-compile-cache-lib demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago.It has 1 open source maintainer collaborating on the project.

Last updated on 16 Apr 2022

Did you know?

Socket installs a Github app to automatically flag issues on every pull request and report the health of your dependencies. Find out what is inside your node modules and prevent malicious activity before you update the dependencies.

Install Socket
Socket

Product

Subscribe to our newsletter

Get open source security insights delivered straight into your inbox. Be the first to learn about new features and product updates.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc