249. The cpl binary allocates with mimalloc (2026-11-22)
- Decision.
crates/cpl-cli/src/main.rssetsmimalloc::MiMallocas the global allocator on every native target (not wasm). The LSP latency test uses the same allocator, sincecpl lspis that binary. - Why. A cold check of the 5,000-line latency file spent about 17% of its
samples in glibc
malloc,freeandrealloc(perf recordon 40 coldDatabase::analyzeruns). The same 40 runs, alternating binaries five times on one machine: 79-136 ms per check with the system allocator, 54-70 ms with mimalloc. The checker allocates many small, short-livedStrings andTys; changing that is compiler's design, the allocator is the binary's. - Reverse. Delete the
#[global_allocator]lines inmain.rsandcrates/cpl-lsp/tests/latency.rsand the twomimallocdependency lines.