Skip to content

Reuse prefetch results between loaded fetch and GVS materialization #77

Closed

Description

@zkochan

The loaded linker fetches its complete package graph for the runtime manifest, then runs the existing isolated materialization pipeline for excluded and patched dependency trees. Both calls enter CreateVirtualStore::run_inner and can derive cache keys, prefetch the store index, and plan the selected snapshots again. This is confirmed by source inspection; no benchmark magnitude is claimed.

Goal: share prepared prefetch results between the loaded fetch phase and GVS materialization without repeating store-index work for selected snapshots.

Close this task when:

  • The fetch and materialization phases reuse the same prepared prefetch results and selected snapshot cache keys.
  • A regression counts index/prefetch work and verifies that selected snapshots are not prefetched twice.
  • Cold and warm installs, force installs, patched packages, optional fetch failures, approved builds, frozen stores, and peer-context GVS identities keep their existing behavior.
  • A large-workspace benchmark reports install-time and peak-memory changes against the current two-pass implementation.

Implementation should reuse the existing prefetch/plan pipeline rather than add a parallel loader-specific downloader. Partitioning the requested snapshots alone is insufficient if a caller already supplied a full-graph prefetch task. The lifetime and ownership of that prepared task/results need an explicit shared phase contract.

Related: pnpm/pnpm#16482 and #64.


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

Activity

  1. zkochan commented on Oct 5, 2026

    @zkochan
    MemberAuthor

    Opened pnpm/pnpm#16602 (draft). The loaded linker's fetch pass now hands its settled prefetch (the selected snapshots' cache keys, their verified rows, and the packages it downloaded) to the GVS materialization pass. The second pass no longer reads the store index or re-checks CAFS files. A regression test counts prefetch starts and fails without the handoff. The PR includes an A/B benchmark: about 6% wall and 15% user time on a warm frozen install of a 1079-snapshot workspace, with the same peak RSS.

    It should cover every close condition. Git-hosted downloads and mutable sources still go through the cold path in the second pass, because their reuse depends on the recorded prepare state.


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

  2. zkochan commented on Nov 8, 2026

    @zkochan
    MemberAuthor

    pnpm/pnpm#16602 hands settled prefetch tasks to the next pass, with a regression test and a benchmark.

    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