From 8a145e7b7641155e813b296fb24361c3ab2dac37 Mon Sep 17 00:00:00 2001 From: Wilfred Hughes Date: Sun, 26 Sep 2021 21:32:49 -0700 Subject: [PATCH] Improving profiling instructions Provide full working examples and mention `perf`. --- manual/src/contributing.md | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/manual/src/contributing.md b/manual/src/contributing.md index 66edadf68..a72c6d101 100644 --- a/manual/src/contributing.md +++ b/manual/src/contributing.md @@ -48,14 +48,21 @@ If you have a file that's particularly slow, you can use which functions are slow. ``` -$ cargo flamegraph --bin difftastic ~/tmp/slow_before.rs ~/tmp/slow_after.rs +$ cargo flamegraph --bin difftastic sample_files/slow_before.rs sample_files/slow_after.rs ``` It's also worth looking at memory usage, as graph traversal bugs can lead to huge memory consumption. ``` -$ /usr/bin/time -v ./target/release/difftastic before.rs after.rs +$ /usr/bin/time -v ./target/release/difftastic sample_files/slow_before.rs sample_files/slow_after.rs +``` + +If timing measurement are noisy, Linux's `perf` tool will report +instructions executed, which is more stable. + +``` +$ perf stat ./target/release/difftastic sample_files/slow_before.rs sample_files/slow_after.rs ``` Many more profiling techniques are discussed in the [The Rust