[Minor perf] Avoid unnecessary allocations #14509
Open
+7
−0
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Commits:
store.late_passes
with 320 andstore.early_passes
with 64, this leaves us some leeway for adding new passes. Note that there are not as many passes are there lints.MALLOC_CONF
for mainly for faster testing, but to also optimize in profiling.This PR makes it so we avoid unnecessary reallocations, oh and we now use
MALLOC_CONF
for some heap-allocation optimization (I tested manually every config flag and came to this conclusion, see jemalloc/TUNING.md). I'm not sure if this would impact on rustup-distributed binaries, but I'm also taking some measures to make sure that rustup-distributed Clippy binaries (and the Rust compiler overall)) use all of JemallocThe performance gains vary depending on factors outside of the users control, but in
wasmi
(my favourite crate to benchmark due to the 66K LOC) it varies between 100ms to 400ms. Overall a solid optimization.How to test:
There are two ways to benchmark, either with
cargo lintcheck --perf
in the checkout and inmaster
, thenperf diff perf.data perf.data.0
, or withRUSTFLAGS="-Zself-profile" cargo dev lint <my_crate>
, and measureme. Choose whichever one is most comfortable.changelog: Minor allocation performance improvements.