ms

Fast abstraction for converting human-like times into milliseconds.


Project maintained by Mnwa Hosted on GitHub Pages — Theme by mattgraham

Benchmarks

There is diff between ms library and ms-converter

Perfomance diff

running 2 tests
test tests::bench_ms_converter ... bench:           8 ns/iter (+/- 0)
test tests::bench_ms_second    ... bench:     328,517 ns/iter (+/- 152,948)

ms_converter is faster than ms by more than 11191 times!

Environment

Metal

Test command

cargo +nightly bench -- --exact

Code

#![feature(test)]
extern crate test;

#[cfg(test)]
mod tests {
    use ms_converter::ms as ms_converter;
    use ms::*;
    use test::Bencher;

    #[bench]
    fn bench_ms_converter(b: &mut Bencher) {
        b.iter(|| ms_converter("1d").unwrap());
    }
    #[bench]
    fn bench_ms_second(b: &mut Bencher) {
        b.iter(|| ms!("1d").unwrap());
    }
}