Skip to content

Benchmark build dependency settings deserialization - #22849

Merged
woodruffw merged 1 commit into
mainfrom
codex/bench-build-dependency-settings
Oct 23, 2026
Merged

woodruffw merged 1 commit into
mainfrom
codex/bench-build-dependency-settings

Conversation

@woodruffw

Copy link
Copy Markdown
Member

Summary

Benchmark the cost of parsing uv.toml build dependency settings into uv_settings::Options. The in-memory fixture contains 16 build constraints and 16 extra build dependencies. Half of each are requirement strings. The other half are tables with hashes or match-runtime.

Run the case in both CodSpeed simulation and walltime to establish a baseline for #22848.

Test plan

  • cargo test --locked -p uv-bench --bench uv_settings -- parse_build_dependency_settings --test
  • cargo fmt --all --check

@codspeed

codspeed Bot commented Oct 22, 2026 •

Copy link
Copy Markdown

Merging this PR will not alter performance

1 warning

⚠️ 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

✅ 87 untouched benchmarks
🆕 2 new benchmarks
⏩ 84 skipped benchmarks1

Performance Changes

Mode Benchmark BASE HEAD Efficiency
🆕 Walltime parse_build_dependency_settings N/A 23.2 µs N/A
🆕 CPU Simulation parse_build_dependency_settings N/A 454.8 µs N/A

Comparing codex/bench-build-dependency-settings (f6821a8) with main (35b0794)

Open in CodSpeed

Footnotes

  1. 84 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. ↩

@woodruffw woodruffw added the internal A refactor or improvement that is not user-facing label Oct 22, 2026
@woodruffw

Copy link
Copy Markdown
Member Author

Note: resolve_activated_extras_independent_pairs[2] appears to be another noisy benchmark.

@woodruffw
woodruffw force-pushed the codex/bench-build-dependency-settings branch from 738cb72 to f6821a8 Compare October 23, 2026 16:26
@woodruffw
woodruffw removed this pull request from stack #22850 October 23, 2026 17:40
@woodruffw
woodruffw added this pull request to stack #22888 October 23, 2026 17:40
@woodruffw
woodruffw merged commit 0928050 into main Oct 23, 2026
120 checks passed
@woodruffw
woodruffw deleted the codex/bench-build-dependency-settings branch October 23, 2026 19:01
woodruffw added a commit that referenced this pull request Oct 23, 2026
Stacked on #22848. The benchmark fixture lives in #22849.

Add `DeserializeUntagged` to `uv-macros` and use it for
`BuildConstraintDependency` and `ExtraBuildDependencyWire`. The derive
dispatches on the input's Serde type and passes the value directly to
the selected variant's deserializer. Each variant must accept a distinct
input shape. Invalid fields and reader errors come from the selected
deserializer.

On the build-settings TOML fixture, local medians across 12 interleaved
runs on arm64 macOS were 20.70 µs for Serde's untagged derive, 17.88 µs
for the handwritten visitors, and 18.12 µs for the macro. These are
optimized development builds. The diff against #22848 keeps the
benchmark fixture and the five deserialization regression tests intact.

All 25 macro and workspace tests and both derive doctests passed on this
branch.

### Other uses

Seven existing visitors can use the same derive. `CoreMetadata`,
`Yanked`, and `ExcludeDependency` were handwritten in #22429. Other
direct fits are `GitPattern`, `PreviewFeaturesOption`,
`ConfigSettingValue`, and `SourcesWire`. A local trial migration of all
seven produced identical values and error messages, including error
positions, on 28 valid and 28 invalid JSON inputs.

With just `CoreMetadata` and `Yanked` switched over, a stripped arm64
macOS release executable that parses `PypiSimpleDetail` grew by 16
bytes. On the 4,096-file Simple API fixture, median time per parse
across 16 alternating pairs was 1.348 ms with handwritten visitors and
1.359 ms with the derive.

`CacheKey` still needs its table visitor to distinguish `file`, `dir`,
`git`, and `env`. The map arm of `Override<T>` also needs its ordered
fallback because both a scoped override and a requirement can
deserialize from a map.

This branch was previously deployed

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

Labels

internal A refactor or improvement that is not user-facing

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants