3 releases
Uses old Rust 2015
0.1.2 | Apr 3, 2017 |
---|---|
0.1.1 | Apr 1, 2017 |
0.1.0 | Apr 1, 2017 |
#14 in #measure-time
8,160 downloads per month
Used in 28 crates
(4 directly)
7KB
115 lines
Time a block of Rust code
[dependencies]
elapsed = "0.1"
extern crate elapsed;
use elapsed::measure_time;
fn main() {
let (elapsed, sum) = measure_time(|| {
(0..10_000).sum::<u64>()
});
println!("elapsed = {}", elapsed);
println!("sum = {}", sum);
// Prints
// elapsed = 227.81 μs
// sum = 49995000
}
Inspired by measureTimeMillis
in
Kotlin.