mirror of
https://codeberg.org/icewind/tf-log-parser.git
synced 2026-06-03 18:24:09 +02:00
iai benches
This commit is contained in:
parent
58100e5f7b
commit
110cb32c77
3 changed files with 26 additions and 1 deletions
20
benches/iai.rs
Normal file
20
benches/iai.rs
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
use iai::black_box;
|
||||
use tf_log_parser::{parse, RawEvent};
|
||||
|
||||
static LOG: &str = include_str!("../test_data/log_2892242.log");
|
||||
|
||||
pub fn parse_benchmark() {
|
||||
black_box(parse(black_box(&LOG))).ok();
|
||||
}
|
||||
|
||||
pub fn parse_raw() {
|
||||
black_box(
|
||||
black_box(&LOG)
|
||||
.split("L ")
|
||||
.filter(|line| !line.is_empty())
|
||||
.flat_map(RawEvent::parse)
|
||||
.count(),
|
||||
);
|
||||
}
|
||||
|
||||
iai::main!(parse_benchmark, parse_raw);
|
||||
Loading…
Add table
Add a link
Reference in a new issue