Repository navigation
Conversation
|
@bors try @rust-timer queue |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Use adaptive sparse encoding for metadata tables
This comment has been minimized.
This comment has been minimized.
|
Finished benchmarking commit (cef35eb): comparison URL. Overall result: ❌ regressions - please read:Benchmarking means the PR may be perf-sensitive. It's automatically marked not fit for rolling up. Overriding is possible but disadvised: it risks changing compiler perf. Next, please: If you can, justify the regressions found in this try perf run in writing along with @bors rollup=never rustc-perf Instruction countOur most reliable metric. Used to determine the overall result above. However, even this metric can be noisy.
Max RSS (memory usage)Results (primary -3.8%, secondary -4.2%)A less reliable metric. May be of interest, but not used to determine the overall result above.
CyclesResults (primary 1.8%, secondary -6.4%)A less reliable metric. May be of interest, but not used to determine the overall result above.
Binary sizeResults (primary -0.6%)A less reliable metric. May be of interest, but not used to determine the overall result above.
Bootstrap: 489.187s -> 489.99s (0.16%) |
|
I think the instruction-count regressions, averaging 0.66% across the affected benchmark cases, are an acceptable trade-off for the 20.15% average reduction in crate metadata size. https://perf.rust-lang.org/compare.html?start=2834d57549e77dbd7e9fa42f51aa349f8a00368b&end=cef35eba824ffd8f61ba555d23a22c5938662a2a&stat=size%3Acrate_metadata |
|
CC @jyn514 those metadata size reduction results will probably be interesting :) |
| len | ||
| }; | ||
| let sparse = | ||
| u32::try_from(non_defaults).is_ok() && index_bytes + non_defaults * width < len * width; |
There was a problem hiding this comment.
The sparse form is used if it saves any amount of space. If a table is almost full the space saving will be small but we will pay the full speed cost of the sparse layout. It would be worth trying a few different policies, e.g. only use the sparse form if the table is less than 90% full or 75%, or 50%. The best fraction will hopefully give most of the metadata size reductions while incurring a smaller instruction count cost.
| return Default::default(); | ||
| } | ||
| let base = | ||
| u32::from_le_bytes(metadata.blob()[start + 8..start + 12].try_into().unwrap()); |
There was a problem hiding this comment.
You could read metadata.blob()[start + 12] and then read from offsets 0 and 8, which would avoid one bounds check.
fa18cf1 to
0a7e283
Compare
|
This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed. Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers. |
Use adaptive sparse encoding for metadata tables
0a7e283 to
de21c98
Compare
|
Try build cancelled. Cancelled workflows: Hint: if you want to run another try build, you do not need to manually cancel the previous one. Just run |
|
@bors try @rust-timer queue |
|
This pull request is already queued and waiting for a try build to finish. |
|
⌛ Trying commit de21c98 with merge a7d52aa… To cancel the try build, run the command Workflow: https://github.com/rust-lang/rust/actions/runs/39846373166 |
Use adaptive sparse encoding for metadata tables
|
@bors try @rust-timer queue |
|
This pull request is already queued and waiting for a try build to finish. |
|
⌛ Trying commit de21c98 with merge 6ea9563… To cancel the try build, run the command Workflow: https://github.com/rust-lang/rust/actions/runs/39902737994 |
Use adaptive sparse encoding for metadata tables
|
@rust-timer build a7d52aa |
|
Queued a7d52aa with parent c303e41, future comparison URL. |
r? @nnethercote
I have added this implementation partially following the approach suggested in the existing FIXME comment.
Each 64-element block stores a cumulative count of preceding non-default values, enabling constant-time lookup by combining that count with a popcount of the bitmap bits before the requested position.
In local measurements,
.rmetafile sizes decreased for all four crates in both Check and Release builds:LLM disclosure: I used an LLM for some of the analysis in this PR.