chore: add benchmark for SequencedEntryRaw::new_from_entry_bytes
@@ -2,7 +2,7 @@ use chrono::{DateTime, Utc};
use criterion::{criterion_group, criterion_main, Criterion};
use data_types::database_rules::{Error as DataError, Partitioner, Sharder};
use influxdb_line_protocol::ParsedLine;
-use internal_types::entry::{lines_to_sharded_entries, SequencedEntry};
+use internal_types::entry::{lines_to_sharded_entries, SequencedEntry, SequencedEntryRaw};
static LINES: &str = include_str!("../../tests/fixtures/lineproto/prometheus.lp");
@@ -14,6 +14,7 @@ fn sequenced_entry(c: &mut Criterion) {
.unwrap();
let sharded_entries = lines_to_sharded_entries(&lines, &sharder(1), &partitioner(1)).unwrap();
let entry = &sharded_entries.first().unwrap().entry;
+ let data = entry.data();
assert_eq!(
entry
.partition_writes()
@@ -35,6 +36,14 @@ fn sequenced_entry(c: &mut Criterion) {
})
});
+ group.bench_function("new_from_entry_bytes", |b| {
+ b.iter(|| {
+ let sequenced_entry = SequencedEntryRaw::new_from_entry_bytes(23, 2, data).unwrap();
+ assert_eq!(sequenced_entry.clock_value(), 23);
+ assert_eq!(sequenced_entry.writer_id(), 2);
+ })
+ });
+
group.finish();
}
