Title: src: improve compile cache performance and size by anonrig · Pull Request #63861 · nodejs/node · GitHub
Open Graph Title: src: improve compile cache performance and size by anonrig · Pull Request #63861 · nodejs/node
X Title: src: improve compile cache performance and size by anonrig · Pull Request #63861 · nodejs/node
Description: Improves the on-disk compile cache (NODE_COMPILE_CACHE / module.enableCompileCache()): Read path: read cache files with a single exactly-sized read (using the file size from fstat) instead of an exponentially growing buffer, which previously cost O(log N) syscalls/allocations and ~2N bytes of copying per file. Size: compress the cache content on disk with zstd (level 1, prioritizing speed since persistence happens at shutdown), falling back to raw storage when not compressible. Shrinks cache directories ~2-4x and makes the crc32 integrity check cheaper since it now runs over the compressed bytes. The magic number is bumped so files in the old format are discarded as cache misses and overwritten in place. Consume path: hand the cache to V8 through a non-owning CachedData wrapper (BufferNotOwned) instead of copying the entire buffer on every cache hit. The underlying buffer is owned by the cache entry, which outlives the synchronous compilation (same pattern as the vm cached-data path in node_contextify.cc). Corrupted cache files keep degrading to silent cache misses and are regenerated; a corrupted size header can no longer cause an oversized allocation since the zstd frame content size is cross-checked first. Added test/parallel/test-compile-cache-corrupted.js covering bad magic, truncation, content bit-flips, and header corruption. No public API or documented behavior changes; the file format is private to src/compile_cache.cc. Benchmark numbers (cache size and warm-startup timings) to follow in a comment. This change was developed with AI assistance (see Co-authored-by trailer).
Open Graph Description: Improves the on-disk compile cache (NODE_COMPILE_CACHE / module.enableCompileCache()): Read path: read cache files with a single exactly-sized read (using the file size from fstat) instead of an e...
X Description: Improves the on-disk compile cache (NODE_COMPILE_CACHE / module.enableCompileCache()): Read path: read cache files with a single exactly-sized read (using the file size from fstat) instead of an e...
Opengraph URL: https://github.com/nodejs/node/pull/63861
X: @github
Domain: github.com
| route-pattern | /:user_id/:repository/pull/:id/files(.:format) |
| route-controller | pull_requests |
| route-action | files |
| fetch-nonce | v2:8ba3dc2c-7b38-2021-26b9-96df278a305f |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | D7AE:278CA4:9C7B1A:D2C32E:6A4C49A0 |
| html-safe-nonce | 01448f2138376a8f0078339b3e4368a5f5964b8d4de4d1433347d2a45fb5b94c |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJEN0FFOjI3OENBNDo5QzdCMUE6RDJDMzJFOjZBNEM0OUEwIiwidmlzaXRvcl9pZCI6Ijg1ODgyMzM4NTk3NDg2MTI1MTMiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | a505ba58a3b2a29d3d809a0387a290f51a4665fe28b02d3290040e641d6cdbae |
| hovercard-subject-tag | pull_request:3850703620 |
| github-keyboard-shortcuts | repository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/nodejs/node/pull/63861/files |
| twitter:image | https://avatars.githubusercontent.com/u/1935246?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/u/1935246?s=400&v=4 |
| og:image:alt | Improves the on-disk compile cache (NODE_COMPILE_CACHE / module.enableCompileCache()): Read path: read cache files with a single exactly-sized read (using the file size from fstat) instead of an e... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | 3d11bb817438277de2a940854450e83a7d32b6aeb5014e9e6b00a6423900251c |
| turbo-cache-control | no-preview |
| diff-view | unified |
| go-import | github.com/nodejs/node git https://github.com/nodejs/node.git |
| octolytics-dimension-user_id | 9950313 |
| octolytics-dimension-user_login | nodejs |
| octolytics-dimension-repository_id | 27193779 |
| octolytics-dimension-repository_nwo | nodejs/node |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 27193779 |
| octolytics-dimension-repository_network_root_nwo | nodejs/node |
| turbo-body-classes | logged-out env-production page-responsive full-width |
| disable-turbo | true |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 3996b3b83990e134be6c099ab9a7f48f140ae80f |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width