mirror of
https://github.com/allankoechke/rust.git
synced 2026-12-01 17:40:16 +00:00
`VecCache` stores a second set of buckets, `present`, that track the keys used. This supports simpler iteration over the buckets, when doing incremental builds, `-Zincremental-verify-ich`, self-profiling, or rustc debug assertions. However, when doing a full non-incremental build and *not* doing verify-ich, self-profiling, or rustc debug assertions, the second set of buckets are never used, and maintaining them wastes space and instructions. Disable that code for that case, and add assertions ensuring `present` never gets used. Verifying this requires running a local copy of the perf collector that does not pass `-Zincremental-verify-ich` on full builds. I ran the `cargo`, `image`, and `ripgrep` builds locally under both bench and DHAT profiling, and also ran `aws-sdk-ec2` (1.175.1) as a bench. aws-sdk-ec2 full check max-rss improved by 62.6 MiB (1.13%). cargo DHAT peak saved 4.7 MiB (0.74%), max-rss saved 2.6 MiB (0.30%). image DHAT peak saved 2.3 MiB (1.73%), max-rss saved 1.50 MiB (0.53%). ripgrep DHAT peak saved 2.02 MiB (3.22%), max-rss saved 1.10 MiB (0.55%). (Differences in DHAT peak vs max-rss are likely due to allocations vs actually accessed pages within those allocations. Differences in amount saved between benchmarks are due to number of queries and number of buckets needed to hold those queries.) All of these also improved marginally in instructions executed.
For more information about how the query system works, see the rustc dev guide.