Skip to content

PhotoCraft: An open-source, photo editor written by scratch in pure Rust

perf(testkit): sample RSS from /proc/self/statm, not smaps, on Linux (#5399)

xsvm8fe2c74f58dc
diff --git a/crates/testkit/Cargo.toml b/crates/testkit/Cargo.toml
index 0d69300d9..3e8bbed91 100644
--- a/crates/testkit/Cargo.toml
+++ b/crates/testkit/Cargo.toml
@@ -14,5 +14,7 @@ photocraft-raster = { workspace = true }
serde_json = { workspace = true }
[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
-# In-process resident memory for the benchmarks (`perf`; MIT OR Apache-2.0).
-memory-stats = "1.2"
+# In-process resident memory for the benchmarks (`perf`; MIT OR Apache-2.0). `always_use_statm`:
+# on Linux read /proc/self/statm, not /proc/self/smaps, which walks every mapping under the mmap
+# lock and made the 2 ms sampler thread a fifth of a large bench's CPU time.
+memory-stats = { version = "1.2", features = ["always_use_statm"] }