Skip to content

Avoid quadratic index updates in uv add - #277

Draft
zaniebot wants to merge 1 commit into
mainfrom
zb/bughuntperf/256-batch-add-indexes
Draft

Avoid quadratic index updates in uv add#277
zaniebot wants to merge 1 commit into
mainfrom
zb/bughuntperf/256-batch-add-indexes

Conversation

@zaniebot

@zaniebot zaniebot commented Jul 16, 2026

Copy link
Copy Markdown
Collaborator

Adding many --index values with uv add repeatedly scans, reparses, canonicalizes, clones, removes, and repositions the full [[tool.uv.index]] array for each incoming index. The repeated work makes large index updates quadratic before resolution begins.

Batch index updates and preserve existing table formatting, priority, credential redaction, and path matching. Keep the flat/simple synchronization from uv#19818. If uv-dev#57 lands first, preserve its source-reference rename when batching updates.

Performance

A Criterion size sweep on a dedicated 16-vCPU Namespace runner with CPU affinity and an optimized Rust 1.97 build shows the individual path growing quadratically and the batched path linearly:

Indexes Individual updates Batched update Improvement
32 436.11 µs 33.421 µs 13.0×
128 6.8681 ms 134.41 µs 51.1×
512 111.01 ms 554.37 µs 200×
2,048 1.7887 s 2.3203 ms 771×

@zaniebot zaniebot added the build:skip-docker Skip Docker builds for this pull request label Jul 16, 2026
@zaniebot zaniebot closed this Jul 16, 2026
@zaniebot zaniebot reopened this Jul 16, 2026
@zaniebot
zaniebot force-pushed the zb/bughuntperf/256-batch-add-indexes branch from 6a6002a to 083a906 Compare July 16, 2026 07:05
@astral-automations-bot
astral-automations-bot Bot force-pushed the zb/bughuntperf/256-batch-add-indexes branch from 083a906 to 1fbb60c Compare July 22, 2026 13:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

build:skip-docker Skip Docker builds for this pull request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants