Skip to content

pacquet is slower than Bun on the resolution-bound benchmark rows — decomposed #1

Open

Description

@zkochan

Status of pnpm 12 vs Bun on the official benchmark after the recent methodology fixes (trusted lockfile, update-row cache re-warm): the score is 4–4–1, and every row Bun still wins is resolution- or pipeline-bound, not linking-bound. This issue records the decomposition so the remaining work is targeted.

Current table (alotta-files, 50ms RTT / 200 Mbit emulated link, ext4 CI)

row pnpm 12 Bun gap
update 968ms 683ms 285ms
cache (warm cache, no lockfile) 1.1s 749ms ~350ms
trusted lockfile (cold cache) 3.4s 3.0s ~400ms
lockfile+node_modules 61ms 45ms 16ms
cache+lockfile 652ms 748ms pnpm wins
node_modules rows / repeat 16–69ms 44ms–4.2s pnpm wins, up to 60×
clean 5.0s 4.9s ~tie (2.8s bandwidth floor)

Decomposition (TRACE=pacquet::install::phase, pnpr behind the emulated link)

update — a lockfile-constrained re-resolution CPU anomaly. With 43 changed direct deps, warm store and warm packument mirror, resolve_workspace costs 709ms at 4 cores — 5× the 137ms it takes to resolve the entire 1350-package graph from scratch on the same machine. An RTT=0 A/B splits it:

resolve_workspace (4 cores)
50ms RTT 709ms
0ms RTT 403ms

So ~300ms is sequential RTT waves over the changed subtree's depth (structural; Bun pays the same waves), and ~400ms is pure CPU in the re-resolution path that runs when a lockfile exists and the manifest changed — 3× the cost of resolving everything with no lockfile at all. Re-resolution with prior knowledge should be cheaper than resolution without it, not 3× more expensive. Suspect area: the still-satisfied-edge pinning / lockfile-merge machinery (#13982 territory).

cache — resolution + fresh-lockfile build on slow hardware. Resolution itself is fast (128–137ms locally, barely CPU-scaled) — but Bun's cache row (749ms) equals its cache+lockfile row (748ms): from its binary manifest cache, Bun's full-graph resolution is effectively free. Fixing the update-path CPU likely narrows this row too.

trusted lockfile — fetch/extract pipeline. Both managers sit near the 2.8s bandwidth floor for the fixture's 67.6MB; pnpm is +0.6s over the floor, Bun +0.2s. Untraced yet; the extra time is in how download, decompress, and store-write overlap.

What is already ruled out: linking (pnpm wins every warm-node_modules row by 1–2 orders of magnitude; the Linux hardlink-first ladder from pnpm/pnpm#14012 additionally helps CoW filesystems), lockfile verification (the benchmark now runs trustLockfile), registrySupportsTimeField / minimumReleaseAge (A/B'd — no effect on these rows), and cache-state artifacts (fixed benchmark-side).

I'm investigating the update-path resolver CPU first, then the fetch pipeline.

🤖 Generated with Claude Code

Activity

  1. github-actions commented on Aug 19, 2026

    @github-actions

    Oz triage is running now and will classify this issue into one of: Ready to implement, Ready to spec, Needs info, or Wait to implement, and apply the matching pnpm state: label.

    Follow along in Oz: https://oz.warp.dev/runs/01a01a92-293b-7e87-9215-4ca2aa4591f0

  2. github-actions commented on Aug 19, 2026

    @github-actions

    Triage result

    • Issue: #14015 pacquet is slower than Bun on the resolution-bound benchmark rows — decomposed
    • State: Ready to spec
    • Applied label: state: needs design
    • Product / parity: Rust pacquet (pnpm/) resolution/lockfile-reuse path. This is benchmark/perf investigation work, not a user-facing install/add/update/remove behavior change, so it does not require TypeScript-CLI parity.
    • Rationale: The issue is a well-documented decomposition (trace data, RTT A/B split, ruled-out causes) but explicitly frames two of the three remaining gaps as unresolved: the update row's ~400ms CPU cost in the "still-satisfied-edge pinning / lockfile-merge machinery" is only a "suspect area" (per plans/LOCKFILE_RESOLUTION_REUSE.md, which itself lists open follow-ups like unguarded overrides drift and conservative cycle handling), and the trusted lockfile fetch/extract pipeline gap is stated as "untraced yet." No concrete fix or bounded change is proposed yet, so this isn't a one-pass implementation task. The referenced related work (#13982 "pin still-satisfied edges…", perf(link): prefer hardlink over clone in Auto on Linux pnpm#14012 hardlink-preference) is already merged, confirming this is active, ongoing perf work rather than something blocked or out of scope.
    • Next step: Continue the author's planned investigation (profile the update-path resolver CPU, then trace the fetch/extract pipeline) and turn the confirmed root cause(s) into a scoped design/fix before moving this to state: accepted.

    Automated Oz triage.

  3. zkochan commented on Aug 19, 2026

    @zkochan
    MemberAuthor

    Status update — the cold-install tail is now decomposed and mostly fixed:

    Measured decomposition of the trusted-lockfile row (the method: a wire-idle probe on the latency proxy's shared pacing state + pacquet::install::phase traces): mid-stream the emulated link is 100% saturated — per-file CAS hashing overlaps perfectly and is not the bottleneck (an 8-core run moves nothing). The whole pnpm-vs-Bun gap lives at the edges: ~60–95 ms of lead-in before the first tarball request (Bun: 14 ms), and a ~220 ms serial tail after the last byte (trailing big package's verify+extract ≈ 71 ms, its link ≈ 45 ms, store-index SQLite close-checkpoint ≈ 46 ms, finalize + exit ≈ 60 ms).

    Shipped against it:

    Remaining structural item: the update row (~968 vs ~683 ms). Design filed as pnpm/pnpm#14022 (pipelined install — stream final subgraphs into materialization during resolution); the ~300 ms of sequential RTT waves over the changed subtree is the floor for client-side resolution, and the ~260 ms post-resolve pipeline is what pipelining can overlap.

    Also worth a look on your side: the Bencher min-latency thresholds have false-alerted three times this week on runs where the whole fleet drifted 30–50% above the historical baseline (the same run's own pacquet@main sits above the limit too) — a wider upper boundary or a shorter baseline window would stop red checks on neutral PRs.

  4. zkochan commented on Aug 20, 2026

    @zkochan
    MemberAuthor

    Status correction after pnpm/pnpm#14016 merged:

    The final PR did not ship the lockfile memo described in my previous update. That approach was removed before merge. The merged change keeps package-version slots as a compact sorted table and uses binary search for cached-metadata lookups.

    Measured outcome:

    • Local fresh offline resolution: 172.9 ms to 163.8 ms over 100 runs, about 5.3% faster, with byte-identical lockfiles.
    • Local peak RSS: about 3.4% lower.
    • The clean CI rerun versus same-run main was neutral on fresh resolution by mean (251.72 ms versus 251.84 ms) and 2.6% faster by minimum; peer-heavy resolution was neutral by mean and 10.4% faster by minimum.
    • Bencher passed without alerts.

    This is useful incremental work, but it does not by itself close this tracker or establish that the official cache row has flipped against Bun. pnpm/pnpm#14020 and pnpm/pnpm#14021 have also merged; the remaining update/no-lockfile pipelining work is tracked in pnpm/pnpm#14022. I am leaving this issue open and taking the next bounded piece there.


    Written by an agent (Codex, GPT-5).

  5. zkochan commented on Aug 20, 2026

    @zkochan
    MemberAuthor

    pnpm/pnpm#14031 has merged.

    It removes the redundant graph-wide prefetch and reuses the resolver store-index reader and verified-files cache during fresh-install materialization. In the final same-run CI comparison, the hot-cache fresh-install mean improved from 437.4 ms on main to 375.8 ms on the PR head, about 14%. Fresh-resolution and peer-heavy results were broadly neutral and all benchmark gates passed. The controlled local update-row A/B remained flat at 757.6 ms versus 758.9 ms.

    This narrows the no-lockfile/pipeline overhead but does not close the remaining update-row gap, so this tracker should stay open. The next bounded pipeline chunk continues under pnpm/pnpm#14022.


    Written by an agent (Codex, GPT-5).

  6. zkochan commented on Aug 20, 2026

    @zkochan
    MemberAuthor

    pnpm/pnpm#14035 has merged as the second bounded post-resolve cleanup.

    It carries the snapshots materialized by the current install into the link and build tails, limits virtual-store bin linking to that set, and records ignored-script pending builds directly when patches and side-effects-cache overlays do not require the full build graph.

    The controlled alternating update-row A/B improved from 758.1 ms to 744.8 ms by median (1.75%) and from 774.0 ms to 752.0 ms by mean (2.84%). The final integrated suite passed every gate. Its same-run matrix was noisy: warm restore improved from 321.3 ms to 316.8 ms by mean and GVS warm restore from 223.3 ms to 199.0 ms, while hot-cache fresh install moved from 440.7 ms to 487.0 ms; the targeted update row is not part of that CI matrix.

    This narrows the update overhead but does not close this tracker. Resolver/materializer streaming is still unimplemented, so I am taking the next bounded profiling-backed chunk under pnpm/pnpm#14022.


    Written by an agent (Codex, GPT-5).

  7. zkochan commented on Aug 20, 2026

    @zkochan
    MemberAuthor

    The next profiling-backed chunk is open as pnpm/pnpm#14038.

    It removes two redundant bin-linking scans from the common --ignore-scripts update path while preserving the lifecycle-build and public-workspace-hoist cases. In an 8-pair local A/B run of the tracked update scenario (4 cores, 50 ms RTT, 200 Mbit/s), merge base averaged 747.8 ms / 751.0 ms median and the PR averaged 734.3 ms / 732.5 ms median: a 1.8% mean and 2.5% median improvement. Head won 6 of 8 pairs.

    just ready is green with all 8,452 tests passing.


    Written by an agent (Codex, GPT-5).

  8. transferred this issue frompnpm/pnpmon Sep 26, 2026
  9. zkochan commented on Nov 8, 2026

    @zkochan
    MemberAuthor

    Status check against main (2026-11-08).

    The table predates pnpm/pnpm#14016, pnpm/pnpm#14020, pnpm/pnpm#14021, pnpm/pnpm#14031 and pnpm/pnpm#14035, and pnpm/pnpm#14022 is closed. pnpm/pnpm#14038 is still open. On pnpm.io/benchmarks the update row is still about 986 ms, so the main gap probably stands, but that page no longer includes Bun, so a fresh comparison needs its own run.

    Written by an agent (Claude Code, claude-opus-5-5).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions