diff options
Diffstat (limited to 'third_party/rust/humantime/benches/datetime_parse.rs')
-rw-r--r-- | third_party/rust/humantime/benches/datetime_parse.rs | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/third_party/rust/humantime/benches/datetime_parse.rs b/third_party/rust/humantime/benches/datetime_parse.rs new file mode 100644 index 0000000000..4248da281e --- /dev/null +++ b/third_party/rust/humantime/benches/datetime_parse.rs @@ -0,0 +1,47 @@ +#![feature(test)] +extern crate test; + +use chrono::{DateTime}; +use humantime::parse_rfc3339; + +#[bench] +fn rfc3339_humantime_seconds(b: &mut test::Bencher) { + b.iter(|| { + parse_rfc3339("2018-02-13T23:08:32Z").unwrap() + }); +} + +#[bench] +fn datetime_utc_parse_seconds(b: &mut test::Bencher) { + b.iter(|| { + DateTime::parse_from_rfc3339("2018-02-13T23:08:32Z").unwrap() + }); +} + +#[bench] +fn rfc3339_humantime_millis(b: &mut test::Bencher) { + b.iter(|| { + parse_rfc3339("2018-02-13T23:08:32.123Z").unwrap() + }); +} + +#[bench] +fn datetime_utc_parse_millis(b: &mut test::Bencher) { + b.iter(|| { + DateTime::parse_from_rfc3339("2018-02-13T23:08:32.123Z").unwrap() + }); +} + +#[bench] +fn rfc3339_humantime_nanos(b: &mut test::Bencher) { + b.iter(|| { + parse_rfc3339("2018-02-13T23:08:32.123456983Z").unwrap() + }); +} + +#[bench] +fn datetime_utc_parse_nanos(b: &mut test::Bencher) { + b.iter(|| { + DateTime::parse_from_rfc3339("2018-02-13T23:08:32.123456983Z").unwrap() + }); +} |