Skip to content

perf: ctx score --against HEAD is 3x over its hook-path budget on the 2k-file fixture #23

Description

@saldestechnology

Measured

score_3_changed (score with 3 changed files on the 2k-file fixture), ubuntu-latest CI, perf profile:

Run Suite Median Max RSS
29124622840 pr 6576.5 ms 273.1 MB
29126075011 full 5965.1 ms 273.8 MB

Budget is 2000 ms / 300 MB. With the CI budget scale of 1.5, the allowed median is 3000 ms — the measured medians are roughly 2x the scaled allowance, 3x the raw budget. Locally on macOS it is about 4.2 s / 379 MB, so this is not a CI-runner artifact.

Why it matters

ctx score --against HEAD is on the Stop-hook path: under the harness it runs on every session stop, so its latency is paid at the end of every agent session. Every other hook-path scenario is comfortably within budget on the same runs:

  • check_against_head: 163 ms (budget 1000 ms)
  • map_cached: 46 ms (budget 500 ms)
  • index_incremental_1: 210 ms (budget 300 ms)
  • sql_v1_query: 266 ms (budget 500 ms)

score is the outlier by more than an order of magnitude.

Likely suspects

  • score recomputes near-duplicate fingerprints over the whole index on every invocation.
  • Baseline-side symbol metrics are recomputed per file rather than reused.
  • No caching between hook invocations, even though the index and baseline rarely change between consecutive stops.

Consequence

The perf CI job stays advisory (continue-on-error: true) until this is fixed. Flipping the job to required is blocked on this issue.

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