From 63c9314b5bb688a465d3015968c005f1eddd567b Mon Sep 17 00:00:00 2001 From: Jonathan Strong Date: Tue, 21 May 2019 23:58:07 -0400 Subject: [PATCH] add one million writes bench --- Cargo.toml | 3 +++ src/influx.rs | 13 +++++++++++++ 2 files changed, 16 insertions(+) diff --git a/Cargo.toml b/Cargo.toml index 3856ffe..0b1c12e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -56,3 +56,6 @@ disable-short-uuid = [] warnings = [] inlines = [] latency = ["pubsub"] + +[profile.bench] +lto = true diff --git a/src/influx.rs b/src/influx.rs index 41e6948..fe5ec1d 100644 --- a/src/influx.rs +++ b/src/influx.rs @@ -1113,6 +1113,19 @@ mod tests { use super::*; use test::{black_box, Bencher}; + #[bench] + fn write_one_million_rows_to_influx(b: &mut Bencher) { + let influx = InfluxWriter::new("localhost", "test", "log/influx.log", 8192); + let mut n = 0; + b.iter(|| { + for _ in 0..1_000_000 { + let time = influx.nanos(Utc::now()); + n += 1; + measure!(influx, million, i(n), tm(time)); + } + }); + } + #[test] fn it_uses_the_utc_shortcut_to_convert_a_datetime_utc() { const VERSION: &str = "0.3.90";