{"id":14965763,"url":"https://github.com/yarnpkg/v8-compile-cache","last_synced_at":"2025-10-01T00:32:04.032Z","repository":{"id":65984459,"uuid":"131436907","full_name":"yarnpkg/v8-compile-cache","owner":"yarnpkg","description":"Require hook for automatic V8 compile cache persistence","archived":false,"fork":true,"pushed_at":"2018-04-30T18:03:55.000Z","size":778,"stargazers_count":7,"open_issues_count":0,"forks_count":6,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-09-11T13:36:30.492Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"zertosh/v8-compile-cache","license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/yarnpkg.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-04-28T19:08:56.000Z","updated_at":"2024-12-07T05:08:28.000Z","dependencies_parsed_at":"2023-02-19T18:45:40.823Z","dependency_job_id":null,"html_url":"https://github.com/yarnpkg/v8-compile-cache","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/yarnpkg/v8-compile-cache","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yarnpkg%2Fv8-compile-cache","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yarnpkg%2Fv8-compile-cache/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yarnpkg%2Fv8-compile-cache/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yarnpkg%2Fv8-compile-cache/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/yarnpkg","download_url":"https://codeload.github.com/yarnpkg/v8-compile-cache/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yarnpkg%2Fv8-compile-cache/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":277777968,"owners_count":25875397,"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","status":"online","status_checked_at":"2025-09-30T02:00:09.208Z","response_time":75,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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-09-24T13:35:15.963Z","updated_at":"2025-10-01T00:32:03.621Z","avatar_url":"https://github.com/yarnpkg.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"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\n## Internals\n\nThe 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.\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%2Fyarnpkg%2Fv8-compile-cache","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fyarnpkg%2Fv8-compile-cache","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyarnpkg%2Fv8-compile-cache/lists"}