Skip to content

Commit 11f95c7

Browse files
committed
Avoid unnecessary allocations
1. Reserve `store.late_passes` with 320 and `store.early_passes` with 64, this leaves us some leeway for adding new passes. 2. Add [env] with some MALLOC_CONF for mainly for faster testing, but to also optimize in profiling. ;Add comment
1 parent d99cf5c commit 11f95c7

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

.cargo/config.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,3 +30,7 @@ rustflags = ["--remap-path-prefix", "=lintcheck"]
3030
# without increasing total build times.
3131
[profile.dev.package.quine-mc_cluskey]
3232
opt-level = 3
33+
34+
# Configure malloc for faster compiling Clippy itself
35+
[env]
36+
MALLOC_CONF = "percpu_arena:phycpu,metadata_thp:always,dirty_decay_ms:300,muzzy_decay_ms:300"

clippy_lints/src/lib.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -441,6 +441,10 @@ pub fn explain(name: &str) -> i32 {
441441
/// Used in `./src/driver.rs`.
442442
#[expect(clippy::too_many_lines)]
443443
pub fn register_lint_passes(store: &mut rustc_lint::LintStore, conf: &'static Conf) {
444+
// Avoid unnecessary reallocations
445+
store.late_passes.reserve(320);
446+
store.early_passes.reserve(64);
447+
444448
for (old_name, new_name) in deprecated_lints::RENAMED {
445449
store.register_renamed(old_name, new_name);
446450
}

0 commit comments

Comments
 (0)