Skip to content

perf: use v8 serialize/deserialize instead of JSON#9971

Merged
zkochan merged 7 commits intomainfrom
v11-v8-serialize
Nov 6, 2025
Merged

perf: use v8 serialize/deserialize instead of JSON#9971
zkochan merged 7 commits intomainfrom
v11-v8-serialize

Conversation

@zkochan
Copy link
Copy Markdown
Member

@zkochan zkochan commented Sep 14, 2025

close #9965

@zkochan zkochan added this to the v11.0 milestone Oct 27, 2025
@zkochan zkochan changed the base branch from v11 to main October 29, 2025 10:06
@zkochan zkochan force-pushed the v11-v8-serialize branch 5 times, most recently from d76b19b to 35eee72 Compare November 1, 2025 23:58
@zkochan zkochan force-pushed the v11-v8-serialize branch 2 times, most recently from 470a565 to aaf4198 Compare November 2, 2025 20:54
@zkochan zkochan requested a review from Copilot November 5, 2025 23:54
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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-file package with V8 serialization utilities
  • Replaces JSON file operations with V8 serialization across all store and cache operations
  • Updates file extensions from .json to .v8 in 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))
Copy link

Copilot AI Nov 5, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot uses AI. Check for mistakes.
@zkochan zkochan merged commit 9b344c8 into main Nov 6, 2025
10 of 12 checks passed
zkochan added a commit that referenced this pull request Jan 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Use v8 serialized buffer instead of JSON for cache

2 participants