perf: use v8 serialize/deserialize instead of JSON#9971
Conversation
99096cb to
0f85508
Compare
d76b19b to
35eee72
Compare
470a565 to
aaf4198
Compare
aaf4198 to
4b79d31
Compare
There was a problem hiding this comment.
Pull Request Overview
This PR migrates pnpm's global store and cache from JSON-based storage to V8 binary serialization format. The change introduces a new package @pnpm/fs.v8-file that provides utilities for reading/writing V8 serialized files, replacing the previous load-json-file dependency across the codebase. File extensions are changed from .json to .v8 throughout the store and cache.
- Introduces new
@pnpm/fs.v8-filepackage with V8 serialization utilities - Replaces JSON file operations with V8 serialization across all store and cache operations
- Updates file extensions from
.jsonto.v8in store paths and test expectations
Reviewed Changes
Copilot reviewed 62 out of 63 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| fs/v8-file/src/index.ts | New utility module providing V8 file read/write functions |
| fs/v8-file/package.json | Package definition for the new V8 file utilities |
| worker/src/start.ts | Migrates worker file index operations from JSON to V8 format |
| store/cafs/src/getFilePathInCafs.ts | Updates file extension logic from .json to .v8 |
| resolving/npm-resolver/src/pickPackage.ts | Converts package metadata caching to V8 serialization |
| store/package-store/src/storeController/prune.ts | Updates pruning logic to handle .v8 files |
| Multiple test files | Updates test expectations for new .v8 file extensions |
| Multiple package.json files | Adds @pnpm/fs.v8-file dependency and removes load-json-file |
Files not reviewed (1)
- pnpm-lock.yaml: Language not supported
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| // in order to avoid ENAMETOOLONG errors | ||
| const temp = `${filePath.slice(0, -11)}${process.pid}` | ||
| gfs.writeFileSync(temp, JSON.stringify(data)) | ||
| gfs.writeFileSync(temp, v8.serialize(data)) |
There was a problem hiding this comment.
The comment on line 357 references '-index.json' but should be updated to '-index.v8' since the file extension has changed. The comment currently says 'We remove the "-index.json" from the end of the temp file name' but this no longer matches the actual file extension being used.
close #9965