{"_id":"v8-compile-cache-lib","_rev":"231722","name":"v8-compile-cache-lib","description":"Require hook for automatic V8 compile cache persistence","dist-tags":{"latest":"3.0.1"},"maintainers":[{"name":"cspotcode","email":""}],"time":{"modified":"2023-03-24T15:40:12.000Z","created":"2021-03-19T23:42:05.346Z","3.0.1":"2022-04-16T01:03:39.155Z","3.0.0":"2021-03-19T23:42:05.346Z"},"users":{},"author":{"name":"Andrew Bradley","email":"cspotcode@gmail.com"},"repository":{"type":"git","url":"git+https://github.com/cspotcode/v8-compile-cache-lib.git"},"versions":{"3.0.1":{"name":"v8-compile-cache-lib","version":"3.0.1","description":"Require hook for automatic V8 compile cache persistence","main":"v8-compile-cache.js","scripts":{"bench":"bench/run.sh","eslint":"eslint --max-warnings=0 .","tap":"tap test/*-test.js","test":"npm run tap","posttest":"npm run eslint"},"author":{"name":"Andrew Bradley","email":"cspotcode@gmail.com"},"repository":{"type":"git","url":"git+https://github.com/cspotcode/v8-compile-cache-lib.git"},"license":"MIT","dependencies":{},"devDependencies":{"babel-core":"6.26.3","eslint":"^7.12.1","flow-parser":"0.136.0","rimraf":"^2.5.4","rxjs":"6.6.3","semver":"^5.3.0","tap":"^9.0.0","temp":"^0.8.3","yarn":"1.22.10"},"bugs":{"url":"https://github.com/cspotcode/v8-compile-cache-lib/issues"},"homepage":"https://github.com/cspotcode/v8-compile-cache-lib#readme","_id":"v8-compile-cache-lib@3.0.1","_nodeVersion":"17.3.1","_npmVersion":"6.14.15","dist":{"shasum":"6336e8d71965cb3d35a1bbb7868445a7c05264bf","size":6391,"noattachment":false,"key":"/v8-compile-cache-lib/-/v8-compile-cache-lib-3.0.1.tgz","tarball":"http://name.csiicloud.com:7001/v8-compile-cache-lib/download/v8-compile-cache-lib-3.0.1.tgz"},"_npmUser":{"name":"cspotcode","email":"cspotcode@gmail.com"},"directories":{},"maintainers":[{"name":"cspotcode","email":""}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/v8-compile-cache-lib_3.0.1_1650071019009_0.025645322864183306"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2022-04-16T01:03:42.287Z","publish_time":1650071019155,"_cnpm_publish_time":1650071019155},"3.0.0":{"name":"v8-compile-cache-lib","version":"3.0.0","description":"Require hook for automatic V8 compile cache persistence","main":"v8-compile-cache.js","scripts":{"bench":"bench/run.sh","eslint":"eslint --max-warnings=0 .","tap":"tap test/*-test.js","test":"npm run tap","posttest":"npm run eslint"},"author":{"name":"Andrew Bradley","email":"cspotcode@gmail.com"},"repository":{"type":"git","url":"git+https://github.com/cspotcode/v8-compile-cache-lib.git"},"license":"MIT","dependencies":{},"devDependencies":{"babel-core":"6.26.3","eslint":"^7.12.1","flow-parser":"0.136.0","rimraf":"^2.5.4","rxjs":"6.6.3","semver":"^5.3.0","tap":"^9.0.0","temp":"^0.8.3","yarn":"1.22.10"},"gitHead":"9302bac4374ed1a4c438c0d73153c7c333e4404a","bugs":{"url":"https://github.com/cspotcode/v8-compile-cache-lib/issues"},"homepage":"https://github.com/cspotcode/v8-compile-cache-lib#readme","_id":"v8-compile-cache-lib@3.0.0","_nodeVersion":"10.16.3","_npmVersion":"6.9.0","dist":{"shasum":"0582bcb1c74f3a2ee46487ceecf372e46bce53e8","size":6368,"noattachment":false,"key":"/v8-compile-cache-lib/-/v8-compile-cache-lib-3.0.0.tgz","tarball":"http://name.csiicloud.com:7001/v8-compile-cache-lib/download/v8-compile-cache-lib-3.0.0.tgz"},"_npmUser":{"name":"cspotcode","email":"cspotcode@gmail.com"},"directories":{},"maintainers":[{"name":"cspotcode","email":""}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/v8-compile-cache-lib_3.0.0_1616197325220_0.2306999092979689"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2021-12-27T08:08:27.068Z","publish_time":1616197325346,"_cnpm_publish_time":1616197325346}},"readme":"# v8-compile-cache-lib\n\n> Fork of [`v8-compile-cache`](https://www.npmjs.com/package/v8-compile-cache) exposed as an API for programmatic usage in other libraries and tools.\n\n---\n\n[![Build status](https://img.shields.io/github/workflow/status/cspotcode/v8-compile-cache-lib/Continuous%20Integration)](https://github.com/cspotcode/v8-compile-cache-lib/actions?query=workflow%3A%22Continuous+Integration%22)\n\n`v8-compile-cache-lib` attaches a `require` hook to use [V8's code cache](https://v8project.blogspot.com/2015/07/code-caching.html) to speed up instantiation time. The \"code cache\" is the work of parsing and compiling done by V8.\n\nThe ability to tap into V8 to produce/consume this cache was introduced in [Node v5.7.0](https://nodejs.org/en/blog/release/v5.7.0/).\n\n## Usage\n\n1. Add the dependency:\n\n  ```sh\n  $ npm install --save v8-compile-cache-lib\n  ```\n\n2. Then, in your entry module add:\n\n  ```js\n  require('v8-compile-cache-lib').install();\n  ```\n\n**`.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`.**\n\n## Options\n\nSet the environment variable `DISABLE_V8_COMPILE_CACHE=1` to disable the cache.\n\nCache directory is defined by environment variable `V8_COMPILE_CACHE_CACHE_DIR` or defaults to `<os.tmpdir()>/v8-compile-cache-<V8_VERSION>`.\n\n## Internals\n\nCache 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.\n\n## Benchmarks\n\nSee https://github.com/cspotcode/v8-compile-cache-lib/tree/master/bench.\n\n**Load Times:**\n\n| Module           | Without Cache | With Cache |\n| ---------------- | -------------:| ----------:|\n| `babel-core`     | `218ms`       | `185ms`    |\n| `yarn`           | `153ms`       | `113ms`    |\n| `yarn` (bundled) | `228ms`       | `105ms`    |\n\n_^ Includes the overhead of loading the cache itself._\n\n## Acknowledgements\n\n* The original [`v8-compile-cache`](https://github.com/zertosh/v8-compile-cache) from which this library is forked.\n* `FileSystemBlobStore` and `NativeCompileCache` are based on Atom's implementation of their v8 compile cache: \n  - https://github.com/atom/atom/blob/b0d7a8a/src/file-system-blob-store.js\n  - https://github.com/atom/atom/blob/b0d7a8a/src/native-compile-cache.js\n* `mkdirpSync` is based on:\n  - https://github.com/substack/node-mkdirp/blob/f2003bb/index.js#L55-L98\n","_attachments":{},"homepage":"https://github.com/cspotcode/v8-compile-cache-lib#readme","bugs":{"url":"https://github.com/cspotcode/v8-compile-cache-lib/issues"},"license":"MIT"}