Skip to content

Serve path: short-circuit withheld walk when no path-scoped rule can withhold #50

Closed

Description

@beardthelion

Surfaced by CodeRabbit on #46.

The clone/fetch serve path in api/repos.rs runs the full visibility_pack::withheld_blob_oids ref walk on every request before deciding whether any blob is actually withheld, then falls back to a plain upload_pack when the set comes back empty. For repos with no path-scoped rules (the common public case) that walk can never withhold anything, so it is pure overhead per clone.

This got more expensive with #42: blob_paths now walks every ref via git ls-tree -r rather than just heads/tags, so the wasted scan is broader. Short-circuit before spawning the walk when the rule set is empty or root-only (no rule with a non-"/" path glob), and only run withheld_blob_oids when a path-scoped rule exists.

Owning PR: #28/#33 (serve path); cost amplified by #42.

Activity

  1. added
    kind:perf
    crate:node
    subsystem:visibility
    sev:low
    on Jun 22, 2026
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

    crate:nodekind:perfsev:lowsubsystem:visibility

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions