Repository navigation
Conversation
Merging this PR will improve performance by 10.22%
|
| Mode | Benchmark | BASE |
HEAD |
Efficiency | |
|---|---|---|---|---|---|
| ⚡ |
Simulation | discover_workspace_from_all_members_with_excludes |
164.1 ms | 148.9 ms | +10.22% |
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/opportunity-09-06-inline-installed-indices (708b2f9) with main (a03d0cd)
Footnotes
-
35 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. ↩
| by_url: FxHashMap<DisplaySafeUrl, SmallVec<[usize; 1]>>, | ||
| } | ||
|
|
||
| /// Keep single installations inline and reserve a small run when duplicate records spill. |
There was a problem hiding this comment.
Is this comment documenting this function clearly?
07cefeb to
708b2f9
Compare
SitePackagesallocates a separate index vector for each package name and direct-source URL, even when it contains only one distribution. Store that first index inline and reserve a small heap buffer when duplicates require spilling, retaining insertion order, tombstone filtering, and the owned query results.Hyperfine 2.0.0 measurements of 301799d97 → 07cefeb10 used release builds with Rust 1.99.0 and CPython 3.12.13 on an AMD EPYC-Genoa Linux VM, pinned to four CPUs. The command was
uv pip list --format json --target FIXTURE --python PYTHON --offline --no-config --color never --cache-dir CACHE, with warm OS page caches and interpreter-discovery metadata. Output went to/dev/null.Singleton fixtures contain generated
.dist-infodirectories with one distribution per name; direct-source fixtures also have one editablefile:URL per name indirect_url.json. The duplicate fixture has 12,500 names and URLs with four versions each, exercising heap spill in both indexes. These are synthetic metadata fixtures; the 50,000-distribution cases are stress workloads.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 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 or separate runs.
The largest singleton fixtures reduce mean peak RSS by about 1.4–1.9 MiB. Most runtime intervals include zero; the 50,000-distribution registry case shows a small reduction. Neither metric establishes an improvement in the duplicate fixture. The empty-target control also shifts RSS by about 0.15 MiB, so the small-environment RSS differences should not be attributed entirely to index allocation. These whole-command measurements include startup, directory traversal, distribution filename and direct-source JSON parsing, sorting, and serialization. RSS is Hyperfine's Linux
wait4peak, not an allocation count or summed simultaneous process-tree memory.