HJSHIN
September 5, 2023, 5:59am
1
Hello everyone!
I want to benchmark vec
and vec_deque
in Rust and I'm looking to utilize the benchmark code that's already available within Rust.
Does anyone know how to use this?
PATH: vec.rs
and vec_deque.rs
inside rust/library/alloc/benches
Thank you
Whilst in the directory library/alloc
, run the command cargo bench
to execute the benchmarks in benches
. All the current ones are for the collections in alloc
.
These are setup in library/alloc/Cargo.toml
:
[[bench]]
name = "collectionsbenches"
path = "benches/lib.rs"
test = true
[[bench]]
name = "vec_deque_append_bench"
path = "benches/vec_deque_append.rs"
harness = false
If you need more control over which benchmarks execute and how they execute, I suggest looking at the docs for cargo bench
.