Skip to content

Index interned marker nodes by ID - #2072

Draft
zaniebot wants to merge 3 commits into
zb/allocator-api-benchmarksfrom
zb/marker-interner-node-ids
Draft

zaniebot wants to merge 3 commits into
zb/allocator-api-benchmarksfrom
zb/marker-interner-node-ids

Conversation

@zaniebot

@zaniebot zaniebot commented Sep 24, 2026 •

Copy link
Copy Markdown
Collaborator

The marker interner owns each decision node in its shared store and also clones the node, including its outgoing edge ranges, into the uniqueness map. Index the immutable shared nodes by NodeId instead. Hashing and equality still use the complete node, while the index retains only an ID and new nodes move directly into their shared storage.

Hyperfine 2.0.0 measurements of e18f413b2 → 166a8ed8c 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. Repeated expressions, distinct version-and-machine expressions, categorical values, and version exclusions exercise fresh marker interning alongside lock parsing and output formatting. 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 / version-and-machine marker / shared marker 17.1 → 16.8 ms -1.94% [-3.31%, -0.44%] 25.22 → 25.25 MiB +0.11% [-0.47%, +0.62%]
metadata / 8,192 edges / version-and-machine marker / shared marker 101.7 → 101.0 ms -0.68% [-1.34%, -0.03%] 50.73 → 50.82 MiB +0.18% [-0.05%, +0.43%]
metadata / 1,024 edges / version-and-machine marker / distinct markers 36.3 → 30.5 ms -15.90% [-16.70%, -15.11%] 32.99 → 30.22 MiB -8.39% [-8.80%, -7.97%]
metadata / 8,192 edges / version-and-machine marker / distinct markers 197.1 → 152.2 ms -22.76% [-27.88%, -14.33%] 89.39 → 68.56 MiB -23.30% [-23.47%, -23.14%]
metadata / 32,768 edges / version-and-machine marker / distinct markers 804.0 → 594.7 ms -26.03% [-32.16%, -18.84%] 271.41 → 175.09 MiB -35.49% [-35.53%, -35.45%]
metadata / 512 edges / categorical values / 16 per marker / distinct markers 106.2 → 70.0 ms -34.05% [-35.17%, -33.03%] 67.33 → 44.88 MiB -33.35% [-33.49%, -33.22%]
metadata / 512 edges / version exclusions / 16 per marker / distinct markers 136.3 → 91.8 ms -32.69% [-33.49%, -31.93%] 76.88 → 50.62 MiB -34.16% [-34.34%, -34.01%]

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.

All seven runtime intervals indicate reductions. The five distinct-marker workloads reduced elapsed time by 15.90–34.05% and peak RSS by 2.77–96.32 MiB. The two shared-marker controls show smaller runtime reductions of 1.94% and 0.68%, with inconclusive RSS changes. The largest RSS reduction is in the 32,768-edge case: 271.41 MiB to 175.09 MiB. RSS is Hyperfine's Linux wait4 peak, not an allocation count or summed simultaneous process-tree memory.

Earlier measurements

Earlier benchmark study:

In paired macOS arm64 measurements that construct 50,000 distinct version/extra expressions per fresh process, this reduces CPU by 13.4% (95% confidence interval: 11.1% to 15.5%). Separate allocator instrumentation recorded retained requested heap bytes falling from 209,813,019 to 113,344,027, or 46.0%, and total requested bytes falling from 330,768,238 to 137,831,726; allocation-call count was unchanged. These are requested heap bytes, not RSS. Both builds use the same Rust nightly, profiling profile, and production allocator. Repeated parsing of 812 real Jupyter dependency requirements shows no clear gain, and offline Jupyter and Airflow resolution do not establish a command-level speedup.

@zaniebot
zaniebot force-pushed the zb/marker-interner-node-ids branch from 6bde299 to 166a8ed Compare September 24, 2026 00:16
@codspeed

codspeed Bot commented Sep 24, 2026

Copy link
Copy Markdown

Merging this PR will not alter performance

✅ 41 untouched benchmarks
🆕 4 new benchmarks

Performance Changes

Mode Benchmark BASE HEAD Efficiency
🆕 Simulation lockfiles N/A 248.6 µs N/A
🆕 Simulation complex N/A 70.4 µs N/A
🆕 Simulation lockfiles N/A 367 µs N/A
🆕 Simulation lockfiles N/A 292.4 µs N/A

Comparing zb/marker-interner-node-ids (166a8ed) with main (3db6652)1

Open in CodSpeed

Footnotes

  1. No successful run was found on zb/allocator-api-benchmarks (117c9ba) during the generation of this report, so main (3db6652) was used instead as the comparison base. There might be some changes unrelated to this pull request in this report. ↩

@zaniebot zaniebot added risk:3 Credible risk of meaningful incorrect behavior or regression; bounded or recoverable. priority:3 Normal: useful features, documentation, usability, or routine efficiency improvements. size:2 Moderate: one subsystem with meaningful invariants, edge cases, or operational evidence to inspect. labels Sep 24, 2026
@astral-automations-bot
astral-automations-bot Bot force-pushed the zb/allocator-api-benchmarks branch from 117c9ba to 5a553de Compare October 1, 2026 22:28
@zaniebot zaniebot added the build:skip-release Disable building release binaries for a pull request label Oct 7, 2026
@astral-automations-bot
astral-automations-bot Bot force-pushed the zb/allocator-api-benchmarks branch from 5a553de to 20f977d Compare October 7, 2026 21:36
@astral-automations-bot
astral-automations-bot Bot force-pushed the zb/allocator-api-benchmarks branch from 83e15e4 to ecc92a8 Compare October 18, 2026 03:36

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

build:skip-release Disable building release binaries for a pull request performance priority:3 Normal: useful features, documentation, usability, or routine efficiency improvements. risk:3 Credible risk of meaningful incorrect behavior or regression; bounded or recoverable. size:2 Moderate: one subsystem with meaningful invariants, edge cases, or operational evidence to inspect.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant