-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Switches the benchmark framework to Criterion. The default Rust std test framework has a hardcoded goal execution time of 1ms for each benchmark. This makes it unsuitable for sample-based profiling because the benchmark doesn't run for very long. Adds a utility script to run tests under a profiler.
- Loading branch information
1 parent
8c52723
commit 60d4782
Showing
4 changed files
with
80 additions
and
51 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
target | ||
perf.data | ||
perf.data.old | ||
Cargo.lock |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#!/usr/bin/env bash | ||
set -euo pipefail | ||
|
||
export HARFBUZZ_SYS_NO_PKG_CONFIG="" | ||
|
||
# Using jq here would be best, however it's not installed by default on many systems, and this isn't a critical script. | ||
TEST_EXECUTABLE=$( | ||
cargo +nightly bench \ | ||
--message-format=json \ | ||
--no-default-features --no-run | \ | ||
grep '^{"reason":"compiler-artifact"' | \ | ||
sed -n 's/^.*"executable":"\([^"]*\)".*$/\1/p' | ||
) | ||
|
||
exec perf record --call-graph dwarf -- "$TEST_EXECUTABLE" --bench --profile-time 5 "$@" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters