Browse Source

add one million writes bench

master
Jonathan Strong 5 years ago
parent
commit
63c9314b5b
2 changed files with 16 additions and 0 deletions
  1. +3
    -0
      Cargo.toml
  2. +13
    -0
      src/influx.rs

+ 3
- 0
Cargo.toml View File

@@ -56,3 +56,6 @@ disable-short-uuid = []
warnings = [] warnings = []
inlines = [] inlines = []
latency = ["pubsub"] latency = ["pubsub"]

[profile.bench]
lto = true

+ 13
- 0
src/influx.rs View File

@@ -1113,6 +1113,19 @@ mod tests {
use super::*; use super::*;
use test::{black_box, Bencher}; 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] #[test]
fn it_uses_the_utc_shortcut_to_convert_a_datetime_utc() { fn it_uses_the_utc_shortcut_to_convert_a_datetime_utc() {
const VERSION: &str = "0.3.90"; const VERSION: &str = "0.3.90";


Loading…
Cancel
Save