From 1d2d1a47f6b1cc98b82d5dc8a0574b13593dbb60 Mon Sep 17 00:00:00 2001 From: nsfisis Date: Wed, 19 Aug 2026 09:38:20 +0900 Subject: perf(shirabe): use mimalloc as the global allocator Profiling `create-project` showed glibc malloc/free accounting for about 41% of samples: the work is dominated by a very large number of small, short-lived allocations, mostly from decoding repository JSON into PhpMixed. `create-project laravel/laravel`, offline against a warmed cache, all three variants measured in one hyperfine run (8 runs each, identical composer.lock): glibc 3.633 s +- 0.023 (user 3.580 s, sys 2.255 s) mimalloc 3.096 s +- 0.054 (user 3.004 s, sys 2.315 s) -14.8% jemalloc 3.177 s +- 0.028 (user 3.136 s, sys 2.285 s) -12.5% The gain is entirely in user time; system time is unchanged, so the extraction and file-writing half of the run is unaffected. Peak RSS drops slightly, from 267 MB to 257 MB. mimalloc wins over jemalloc and, unlike jemalloc, needs no C build of its own at every profile. The allocator is declared in the library rather than in `main.rs` so that the test and benchmark binaries, which link this crate but not `main.rs`, run against the allocator the binary ships with. Co-Authored-By: Claude Opus 5 --- crates/shirabe/Cargo.toml | 1 + 1 file changed, 1 insertion(+) (limited to 'crates/shirabe/Cargo.toml') diff --git a/crates/shirabe/Cargo.toml b/crates/shirabe/Cargo.toml index 66f2b5fc..653591d4 100644 --- a/crates/shirabe/Cargo.toml +++ b/crates/shirabe/Cargo.toml @@ -29,6 +29,7 @@ futures.workspace = true indexmap.workspace = true jsonschema.workspace = true md5.workspace = true +mimalloc.workspace = true nix.workspace = true regex.workspace = true reqwest.workspace = true -- cgit v1.3.1-4-g156e