Skip to content

Performance regression after switching to v8 serialization format #10409

@gluxon

Description

@gluxon

Using the v8 serialization format rather than JSON for caches (#9971) seems to have caused a 2.33x performance regression to the resolveDependenciesTree function on v11. I noticed this when testing pnpm against a large repro I use at work and observing pnpm install consistently take much longer than it does on v10.

Measurements

I profiled the resolveDependenciesTree function before and after commit 9b344c898. Commit d392c3d05 is the parent commit of 9b344c898.

Test Trial 1 Trial 2 Trial 3 Trial 4 Trial 5 Average (ms)
JSON (d392c3d) 19,758.14 20,165.70 20,887.73 20,538.55 21304.28 20,530.88
V8 buffers (9b344c8) 46,971.59 47,418.23 47004.95 50838.92 46840.28 47,814.79

The changes I made to support profiling can be found here: a50b919

Each test run had a warmup installation and was done from a fully populated pnpm store.

Specs

MacBook Pro (16-inch, Nov 2023)
Chip: M3 Pro
Memory 36 GB

Node.js v24.11.0
macOS 26.2

CPU Profiles

Looking at a left-heavy CPU profile, the readV8FileStrictAsync and v8.deserialize calls take around ~33s.

Image

This compares to ~7s for JSON.parse in the prior commit.

Image

This was comparing 2 CPU profiles of the ~10 that I took.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions