Skip to content

Commit e49ff02

Browse files
committed
Add benchmarks using iai-callgrind
This crate [1] makes it reasonably easy to get instruction count performance metrics that are stable enough to run in CI, and has worked out well since integrating it with `libm`. Add new benchmarks for `mem` functions using `iai-callgrind`, modeling them off of the existing benchmarks. [1]: https://github.com/iai-callgrind/iai-callgrind
1 parent 52d96c4 commit e49ff02

File tree

2 files changed

+488
-0
lines changed

2 files changed

+488
-0
lines changed

testcrate/Cargo.toml

+14
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ doctest = false
1616
rand_xoshiro = "0.6"
1717
# To compare float builtins against
1818
rustc_apfloat = "0.2.1"
19+
# Really a dev dependency, but dev dependencies can't be optional
20+
iai-callgrind = { version = "0.14.0", optional = true }
1921

2022
[dependencies.compiler_builtins]
2123
path = "../compiler-builtins"
@@ -47,9 +49,16 @@ no-sys-f16-f64-convert = []
4749
# Skip tests that rely on f16 symbols being available on the system
4850
no-sys-f16 = ["no-sys-f16-f64-convert"]
4951

52+
# Enable icount benchmarks (requires iai-callgrind and valgrind)
53+
icount = ["dep:iai-callgrind"]
54+
5055
# Enable report generation without bringing in more dependencies by default
5156
benchmarking-reports = ["criterion/plotters", "criterion/html_reports"]
5257

58+
# NOTE: benchmarks must be run with `--no-default-features` or with
59+
# `-p testcrate`, otherwise the default `compiler-builtins` feature of the
60+
# `compiler_builtins` crate gets activated, resulting in linker errors.
61+
5362
[[bench]]
5463
name = "float_add"
5564
harness = false
@@ -85,3 +94,8 @@ harness = false
8594
[[bench]]
8695
name = "float_pow"
8796
harness = false
97+
98+
[[bench]]
99+
name = "mem_icount"
100+
harness = false
101+
required-features = ["icount"]

0 commit comments

Comments
 (0)