{"id":13527204,"url":"https://github.com/zertosh/v8-compile-cache","last_synced_at":"2025-05-14T08:08:48.793Z","repository":{"id":40002970,"uuid":"82726308","full_name":"zertosh/v8-compile-cache","owner":"zertosh","description":"Require hook for automatic V8 compile cache persistence","archived":false,"fork":false,"pushed_at":"2023-12-12T10:22:39.000Z","size":809,"stargazers_count":731,"open_issues_count":23,"forks_count":40,"subscribers_count":10,"default_branch":"master","last_synced_at":"2025-03-31T17:08:53.116Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/zertosh.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-02-21T20:56:26.000Z","updated_at":"2025-03-23T07:59:28.000Z","dependencies_parsed_at":"2024-06-11T18:56:08.211Z","dependency_job_id":"ec9b1e88-a383-4bdf-ba68-1ebaae0d43a9","html_url":"https://github.com/zertosh/v8-compile-cache","commit_stats":{"total_commits":107,"total_committers":10,"mean_commits":10.7,"dds":"0.11214953271028039","last_synced_commit":"b6bc035d337fbda0e6e3ec7936499048fc9deafc"},"previous_names":[],"tags_count":13,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zertosh%2Fv8-compile-cache","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zertosh%2Fv8-compile-cache/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zertosh%2Fv8-compile-cache/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zertosh%2Fv8-compile-cache/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zertosh","download_url":"https://codeload.github.com/zertosh/v8-compile-cache/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248327563,"owners_count":21085253,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-01T06:01:43.178Z","updated_at":"2025-04-11T01:42:35.606Z","avatar_url":"https://github.com/zertosh.png","language":"JavaScript","funding_links":[],"categories":["Repository","JavaScript"],"sub_categories":["Performance Optimization"],"readme":"# v8-compile-cache\n\n[![Build Status](https://travis-ci.org/zertosh/v8-compile-cache.svg?branch=master)](https://travis-ci.org/zertosh/v8-compile-cache)\n\n`v8-compile-cache` 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\n  ```\n\n2. Then, in your entry module add:\n\n  ```js\n  require('v8-compile-cache');\n  ```\n\n**Requiring `v8-compile-cache` in Node \u003c5.7.0 is a noop – but you need at least Node 4.0.0 to support the ES2015 syntax used by `v8-compile-cache`.**\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 `\u003cos.tmpdir()\u003e/v8-compile-cache-\u003cV8_VERSION\u003e`.\n\n## Internals\n\nCache files are suffixed `.BLOB` and `.MAP` 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.\n\n## Benchmarks\n\nSee https://github.com/zertosh/v8-compile-cache/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* `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","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzertosh%2Fv8-compile-cache","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzertosh%2Fv8-compile-cache","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzertosh%2Fv8-compile-cache/lists"}