Repository navigation
Conversation
Merging this PR will improve performance by 79.31%
|
| Mode | Benchmark | BASE |
HEAD |
Efficiency | |
|---|---|---|---|---|---|
| ⚡ | WallTime | resolve_activated_extras[32] |
85.5 µs | 38.1 µs | ×2.2 |
| ⚡ | Simulation | resolve_activated_extras[32] |
1,188.7 µs | 614.5 µs | +93.44% |
| ⚡ | WallTime | resolve_activated_extras[16] |
22.7 µs | 13.5 µs | +68.51% |
| ⚡ | Simulation | resolve_activated_extras[16] |
347.3 µs | 245.8 µs | +41.27% |
| 🆕 | WallTime | resolve_shared_extra_pairs[12] |
N/A | 33.8 µs | N/A |
| 🆕 | WallTime | resolve_shared_extra_pairs[20] |
N/A | 86 µs | N/A |
| 🆕 | WallTime | resolve_shared_extra_pairs[4] |
N/A | 6.5 µs | N/A |
| 🆕 | Simulation | resolve_shared_extra_pairs[12] |
N/A | 502.5 µs | N/A |
| 🆕 | Simulation | resolve_shared_extra_pairs[20] |
N/A | 1.3 ms | N/A |
| 🆕 | Simulation | resolve_shared_extra_pairs[4] |
N/A | 142.5 µs | N/A |
Tip
Curious why performance improved? Comment @codspeedbot explain why performance improved on this PR, or directly use the CodSpeed MCP with your agent.
Comparing zb/balance-marker-parsing (c488641) with zb/resolve-activated-extras-in-bdd (3b3a7b5)2
Footnotes
-
47 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. ↩
-
No successful run was found on
zb/resolve-activated-extras-in-bdd(1f7c651) during the generation of this report, so 680d2e6 was used instead as the comparison base. There might be some changes unrelated to this pull request in this report. ↩
| assert!( | ||
| MarkerTree::from_str(&format!("{input} {operator} (python_version <)")).is_err() | ||
| ); |
There was a problem hiding this comment.
[P3] Assert the diagnostic from the malformed trailing expression
This assertion can pass without parsing (python_version <): an early return after combining the first two top-level terms would satisfy the valid-input assertion, while parse_markers_cursor would reject the leftover and/or in the invalid input. Consequently, the test does not establish that constant-result shortcuts preserve the trailing expression's diagnostic. Use a short fixture with the existing parse_err and assert_snapshot! helpers to verify that the error points to the malformed expression.
a4959c8 to
5ce70de
Compare
| // Pair adjacent expressions instead of repeatedly extending one growing decision diagram. | ||
| // Long clauses can then share intermediate subgraphs without constructing every prefix. | ||
| while expressions.len() > 1 { | ||
| let length = expressions.len(); | ||
| for (output, index) in (0..length).step_by(2).enumerate() { |
There was a problem hiding this comment.
[P3] Add a benchmark for cold Boolean-chain parsing
The supplied imbibe_and_format benchmark times imbibe and try_to_string, not marker parsing, so its improvement does not validate this reduction strategy. The new tests assert semantic equivalence but do not measure construction costs. Add a focused base/head comparison for long and/or chains and common short markers, using identical build settings and fresh processes or otherwise cold interner state: the global interner's memoized operations would hide temporary graph construction on repeated inputs. This would justify the added buffering and reduction logic and make performance regressions detectable.
Long `and` and `or` chains currently build and intern each intermediate prefix. We combine adjacent expressions in pairs instead, after parsing every term so constant results cannot hide later errors or warnings. On an AMD EPYC devbox, MTEB frozen export fell from 4.20 s to 1.25 s and peak RSS from 1,631 MiB to 299 MiB. Parsing a 512-term AND with a fresh interner fell from 275 ms to 4.65 ms; repeated parsing of a two-predicate marker was 4.3% slower. The identical-binary control showed substantial timing variation. [Measurements](https://gist.github.com/charliermarsh/1800e26e59fc6686558bccc3297d38b3). Ports [uv-dev#2161](astral-sh#2161).
Long
andandorchains repeatedly combine a growing decision diagram with one expression while parsing lockfile markers, creating large temporary graphs. Pair adjacent expressions in successive rounds, with direct handling for single expressions and constant results. All input is still parsed so malformed trailing expressions report their errors. Stacks on #2148.Hyperfine 2.0.0 measurements of 3b3a7b5ed → c488641e9 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. The supplied interpreter was CPython 3.12.13.Commands include
uv workspace metadata --script SCRIPT --frozen --python PYTHON --preview-features workspace-metadata. Synthetic frozen script locks contain one root and conditional leaves. Short inputs and AND or OR chains with different numbers of substring predicates cover parsing and subsequent marker 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.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.
The 32- to 512-term
andandorworkloads used 65.75% to 97.70% less elapsed time and 60.10% to 96.78% less peak RSS. The five-term runtime interval includes zero, while its RSS fell by 1.25%. The short shared-marker control ran 3.26% faster with inconclusive RSS; the single-term control ran 0.97% faster and used 0.63% less RSS. These whole-command measurements include marker parsing and formatting, so they do not isolate parsing. RSS is Hyperfine's Linuxwait4peak, not an allocation count or summed simultaneous process-tree memory.