Closed
Description
The musl
allocator is not one of the fastest ones out there. We should consider enabling jemalloc
if possible.
$ target/release/rust-analyzer analysis-stats . Database loaded, 185 roots, 207.149744ms
Crates in this dir: 27
Total modules found: 391
Total declarations: 6479
Total functions: 4882
Item Collection: 12.928391044s, 0b allocated 0b resident
Total expressions: 134876
Expressions of unknown type: 4420 (3%)
Expressions of partially unknown type: 4193 (3%)
Type mismatches: 271
Inference: 38.903396336s, 0b allocated 0b resident
Total: 51.83179408s, 0b allocated 0b resident
$ target/x86_64-unknown-linux-musl/release/rust-analyzer analysis-stats . Database loaded, 185 roots, 236.729051ms
Crates in this dir: 27
Total modules found: 391
Total declarations: 6479
Total functions: 4882
Item Collection: 14.239506998s, 0b allocated 0b resident
Total expressions: 134876
Expressions of unknown type: 4438 (3%)
Expressions of partially unknown type: 4284 (3%)
Type mismatches: 271
Inference: 44.227304328s, 0b allocated 0b resident
Total: 58.466818431s, 0b allocated 0b resident
Activity
matklad commentedon Mar 4, 2020
lnicola commentedon Mar 4, 2020
It does, with a bit of prodding. I had to set my linker to
musl-clang
(remember that~/.cargo/config
tweak?). Looks likemusl-jemalloc
is on par withglibc
.memoryruins commentedon Mar 8, 2020
Noticed that
ripgrep
also enables jemalloc for 64-bit musl https://github.com/BurntSushi/ripgrep/blob/0874aa115c92f102a6ec474944f589667463fcd0/crates/core/main.rs#L29-L44lnicola commentedon May 1, 2020
Update: in #4157 we've switched to
glibc
binaries, so this is partly fixed, assuming it sticks. There's still the option of enablingjemalloc
.matklad commentedon May 1, 2020
Yeah, I think we should maybe close this for now -- if the goal is better perf, the bigger impact would be in optimizing stuff inside rust-analyzer itself.