Skip to content

Share conjunction cache entries between operand orders - #2081

Draft
zaniebot wants to merge 1 commit into
zb/marker-ordered-range-edgesfrom
zb/marker-commutative-and-cache
Draft

zaniebot wants to merge 1 commit into
zb/marker-ordered-range-edgesfrom
zb/marker-commutative-and-cache

Conversation

@zaniebot

@zaniebot zaniebot commented Sep 24, 2026 •

Copy link
Copy Markdown
Collaborator

Marker conjunctions currently cache (left, right) and (right, left) separately, even though both operations produce the same canonical marker. Order the cache key by node ID so the reverse operation reuses the first result without changing the traversal order used to construct it.

Hyperfine 2.0.0 measurements of 40f6dcc4e → 3c0b15962 used release builds of the complete CLI with rustc 1.99.0 (b940084d7 2026-09-28) on an AMD EPYC-Genoa Linux VM, pinned to four CPUs. Output went to /dev/null. Workloads that select or query an interpreter used CPython 3.12.13.

Commands include uv workspace metadata --script SCRIPT --frozen --python PYTHON --preview-features workspace-metadata. The synthetic frozen script locks contain one root and conditional leaves. Pairs of marker operands occur twice in the same or reversed order at three scales; an ordinary short-marker case is included. Complete marker strings stay below the whole-marker-cache threshold. Each command starts a fresh process and rebuilds its in-memory marker caches. OS pages and interpreter-query caches are warm. Frozen commands do not resolve, download, build, or install packages.

Values are means, parent → head. Changes are (head / parent - 1) with 95% confidence intervals; negative values indicate a reduction.

Workload Wall time Change, 95% CI Peak RSS Change, 95% CI
metadata / 64 edges / short marker / shared marker 16.8 → 16.9 ms +0.19% [-1.46%, +1.96%] 25.35 → 25.36 MiB +0.04% [-0.39%, +0.44%]
metadata / 256 edges / operand pairs / same order 22.6 → 20.2 ms -10.50% [-24.59%, +0.84%] 26.12 → 25.99 MiB -0.51% [-0.92%, -0.06%]
metadata / 256 edges / operand pairs / reversed order 19.5 → 19.4 ms -0.41% [-1.58%, +0.82%] 26.02 → 26.07 MiB +0.19% [-0.16%, +0.55%]
metadata / 2,048 edges / operand pairs / same order 42.4 → 42.0 ms -0.81% [-3.69%, +1.21%] 33.22 → 33.25 MiB +0.10% [-0.40%, +0.55%]
metadata / 2,048 edges / operand pairs / reversed order 42.5 → 43.2 ms +1.70% [-1.82%, +7.86%] 33.41 → 33.22 MiB -0.57% [-0.97%, -0.15%]
metadata / 16,384 edges / operand pairs / same order 247.2 → 249.3 ms +0.86% [-14.98%, +21.26%] 84.99 → 84.98 MiB -0.02% [-0.12%, +0.09%]
metadata / 16,384 edges / operand pairs / reversed order 244.7 → 232.3 ms -5.06% [-10.14%, -0.68%] 85.14 → 85.01 MiB -0.16% [-0.27%, -0.04%]

Each workload used ten comparison blocks with alternating revision order, one warmup followed by three measured runs per revision in each block (30 measurements per revision). The pointwise 95% percentile-bootstrap intervals use 20,000 resamples of paired block means and retain all samples. They estimate within-run uncertainty, not variation across machines, independent builds, or separate benchmark campaigns.

Six of seven elapsed-time intervals include zero. The 16,384-edge reversed-order case shows a 5.06% reduction (95% CI 0.68–10.14% lower); the other runtime estimates are inconclusive in this run. Three workloads show small peak-RSS reductions of 0.13–0.19 MiB, while the other four RSS intervals include zero. RSS is Hyperfine's Linux wait4 peak, not an allocation count or summed simultaneous process-tree memory.

Earlier measurements

Earlier benchmark study:

On macOS arm64 with the same Rust nightly for both revisions, the profiling profile, and the production allocator, 51 paired runs of 20,000 fresh operand pairs reduce conjunction wall time by 28.0% (95% confidence interval: 25.2% to 30.7%). Requested allocation bytes fall from 22.2 MB to 18.9 MB in that synthetic workload. Pairing adjacent markers from 812 real Jupyter requirements reduces conjunction wall time by 28.9% across 101 paired runs (interval: 27.3% to 30.5%); parsing those requirements is inconclusive (-0.1% in the improvement direction, interval -1.0% to 0.8%). These component measurements do not establish an end-to-end command speedup.

@codspeed

codspeed Bot commented Sep 24, 2026

Copy link
Copy Markdown

Merging this PR will not alter performance

✅ 45 untouched benchmarks


Comparing zb/marker-commutative-and-cache (3c0b159) with zb/marker-ordered-range-edges (40f6dcc)

Open in CodSpeed

@zaniebot zaniebot added risk:1 Negligible risk of localized mistakes that are obvious and easy to correct. priority:3 Normal: useful features, documentation, usability, or routine efficiency improvements. size:1 Small: one localized behavior with straightforward tests or documentation checks. labels Sep 24, 2026

This branch has not been deployed

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

Labels

performance priority:3 Normal: useful features, documentation, usability, or routine efficiency improvements. risk:1 Negligible risk of localized mistakes that are obvious and easy to correct. size:1 Small: one localized behavior with straightforward tests or documentation checks.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants