Breakwater

Backtest / #1105

perf: Speed up complex SpecifierSet filtering by implementing cost based ordering

pypa/packaging#1105 · merged 2026-03-08 · base 9b972011a5 → head 8810e9e66e · ran on Docker

PASS

No behaviour divergence found by any probe.

Performance · SpecifierSet#filter

No realistic input family measured slower.

Measured in backtest packaging-v2 (same commits, run bt-1105-4c6611, image bw-pair:3124cc07c70a8c7a). The semantic results above are from a later run; perf doesn't use the semantic planner, so it was not re-measured.

head slowerhead faster0.5×0.59×0.71×0.84×1×1001,00010,000input size (characters)F1F1: 0.90× at ~45 charsF1: 0.87× at ~68 charsF1: 0.86× at ~202 charsF1: 0.57× at ~749 charsF1: 0.52× at ~2,874 charsF1: 0.53× at ~11,403 charsF1: 0.51× at ~45,524 chars
  • F1
Head/base cachegrind instructions per call, by input size (log-log). Each line is one input family Nemotron proposed; points above 1× are where the "faster" code does more work.
FamilyInputsRatio range Slope base → headVerdict
F1SpecifierSet.filter with many versions and a mixed set of specifiers (range, compatible, wildcard equality) under warm prerelease handlingclaimed speedup · plan0.51× – 0.90×1.05 → 0.96faster

Receipt

TargetBackendImageRun AuditAdjudication
packaging.specifiers:SpecifierSet#filterlocal Dockerbw-pair:9afc68b04e0ce424bt-1105-0987b9$0.058$0.000

Nemotron cost on Nebius Token Factory. Backend: where the untrusted code ran. local Docker (an image cited by its content-addressed tag). Every image is content-addressed (repo at each commit + harness), so every card re-runs from the image and seed 0. Raw data: audit.