Skip to content

Prototype bounded multiway marker construction - #22682

Draft
charliermarsh wants to merge 1 commit into
charlie/marker-prototype-baselinefrom
charlie/marker-bounded-apply
Draft

charliermarsh wants to merge 1 commit into
charlie/marker-prototype-baselinefrom
charlie/marker-bounded-apply

Conversation

@charliermarsh

@charliermarsh charliermarsh commented Oct 17, 2026 •

Copy link
Copy Markdown
Member

Long Boolean chains can leave many intermediate diagrams interned after parsing. We add bounded four-way AND/OR construction and use it to combine adjacent parser operands. Each batch permits 1,024 fused expansions or range intersections, with a shared tuple cache capped at 4,096 entries; remaining work uses balanced binary construction. Combinations with multiple conflict-sensitive roots use the binary path.

Reading the full MTEB lock allocates 104,399 nodes instead of 155,357, with the same 2,879 reachable nodes. Binary-cache entries fall from 241,934 to 74,463, with 1,444 tuple-cache entries. Fewer retained intermediates do not translate into less CPU work: repeated parsing of the longest real MTEB marker is 80.5% slower (95% interval: 78.4% to 83.3%), against an identical-binary control of +0.3%. Cache occupancy alone cannot identify whether tuple work, cache rotation, or fallback causes that slowdown.

This prototype trades runtime for memory. Full MTEB export uses 19.3% less peak RSS but takes 32.2% longer, and the synthetic fork export is 3.3% slower. Neither result is explained by the identical-binary control. Fresh resolution shows no compensating general improvement. An independent 16-block run also reproduced the uv-docs regressions: resolution was 6.0% slower (95% interval: 4.6% to 6.6%) and export was 7.5% slower (3.0% to 13.3%). This implementation should remain experimental.

Workload Base Candidate Paired time change (95% interval) Peak RSS, base → candidate
Resolve uv docs 52.09 ms 55.85 ms +6.5% [+2.9, +14.6] 44.8 → 44.8 MiB
Resolve MTEB subset (six conflicting extras) 1048.80 ms 1093.00 ms +0.4% [-0.9, +4.0] 159.5 → 158.6 MiB
Resolve 32 synthetic conflicting extras 181.12 ms 183.57 ms +1.7% [-0.5, +3.1] 58.2 → 58.2 MiB
Export uv docs 25.42 ms 27.19 ms +8.5% [+0.2, +17.3] 30.5 → 30.2 MiB
Export MTEB subset, nvembed 32.90 ms 35.10 ms +6.2% [-1.6, +10.2] 32.4 → 32.5 MiB
Export synthetic model 00 85.85 ms 88.65 ms +3.3% [+2.9, +3.6] 40.2 → 39.4 MiB
Export full MTEB lockfile 1034.85 ms 1368.19 ms +32.2% [+30.7, +33.3] 191.0 → 154.2 MiB

Measurements compare this head with the preserved experimental baseline, c25eaef4348afc32e31bf089f3d97488344b9614, which includes balanced parsing, compact interning, and range normalization. We use the same compiler, profiling profile, and jemalloc allocator on an AMD EPYC-Milan devbox, with each process pinned to one CPU. The table retains all 12 counterbalanced blocks; times and RSS are medians, while percentages are medians of paired ratios. The 95% bootstrap intervals are descriptive and unadjusted. Fresh resolution uses warm metadata offline and includes lockfile serialization. The MTEB resolver case uses six conflicting extras; the full MTEB lock is a separate export workload.

All five compared builds produce identical lockfile bytes, package selections, exports, and conflict errors. Raw samples, complete methods, reproducible inputs, and the identical-binary control.

The 150 uv-pep508 unit tests and all-target, all-feature package Clippy checks pass.

@codspeed

codspeed Bot commented Oct 17, 2026 •

Copy link
Copy Markdown

Merging this PR will degrade performance by 13.94%

2 warnings

⚠️ 6 benchmarks are dominated by system calls

System calls cannot be simulated consistently and are left out of the measure. The reported value understates the real cost. Switch to the Walltime instrument to measure them.

Learn more about system calls

See affected benchmarks

⚠️ Base and head ran on different runner types

Some benchmarks with significant performance changes were compared across different runner types, so the changes might not come from the code. Run base and head on the same runner type, or use CodSpeed Macro Runners for more stable results.

Learn more about Macro Runners

Open the report in CodSpeed to investigate

❌ 1 regressed benchmark
✅ 116 untouched benchmarks
⏩ 54 skipped benchmarks1

Warning

Please fix the performance issues or acknowledge them on CodSpeed.

Performance Changes

Mode Benchmark BASE HEAD Efficiency
❌ CPU Simulation imbibe_marker_no_conflicts[0] 343 ns 398.5 ns -13.94%

Tip

Investigate this regression by commenting @codspeedbot fix this regression on this PR, or directly use the CodSpeed MCP with your agent.


Comparing charlie/marker-bounded-apply (c0ed639) with charlie/marker-range-normalization (c25eaef)

Open in CodSpeed

Footnotes

  1. 54 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports. ↩

@charliermarsh
charliermarsh changed the base branch from charlie/marker-range-normalization to charlie/marker-prototype-baseline October 17, 2026 17:23

This branch was previously deployed

1 inactive deployment
automations — c0ed639c Deployed Oct 17, 2026 by charliermarsh via review / security review #51498
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

⌂ 换网址