Crates.io | elapsed |
lib.rs | elapsed |
version | 0.1.2 |
source | src |
created_at | 2017-04-01 14:20:03.116331 |
updated_at | 2017-04-03 21:37:30.775744 |
description | Measure execution time of a block of code |
homepage | |
repository | https://github.com/matklad/elapsed.git |
max_upload_size | |
id | 9300 |
size | 6,371 |
[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.