Skip to content

Commit 0494eb6

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 6366e31 commit 0494eb6

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
@@ -23,3 +23,7 @@ split-debuginfo = "unpacked"
2323
rustflags = ["--remap-path-prefix", "=clippy_dev"]
2424
[profile.dev.package.lintcheck]
2525
rustflags = ["--remap-path-prefix", "=lintcheck"]
26+
27+
# Configure malloc for faster compiling Clippy itself
28+
[env]
29+
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
@@ -579,6 +579,10 @@ fn register_categories(store: &mut rustc_lint::LintStore) {
579579
/// Used in `./src/driver.rs`.
580580
#[expect(clippy::too_many_lines)]
581581
pub fn register_lints(store: &mut rustc_lint::LintStore, conf: &'static Conf) {
582+
// Avoid unnecessary reallocations
583+
store.late_passes.reserve(320);
584+
store.early_passes.reserve(64);
585+
582586
register_categories(store);
583587

584588
for (old_name, new_name) in deprecated_lints::RENAMED {

0 commit comments

Comments
 (0)