Skip to content

Commit

Permalink
cleanup lexer benchmark
Browse files Browse the repository at this point in the history
  • Loading branch information
keithamus committed Nov 22, 2024
1 parent 59b80ec commit 0e765a3
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions crates/hdx_lexer/benches/lex_popular.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
use bumpalo::Bump;
use criterion::{criterion_group, criterion_main, BenchmarkId, Criterion, Throughput};
use glob::glob;
use hdx_lexer::{Include, Kind, Lexer};
Expand Down Expand Up @@ -28,15 +27,13 @@ fn popular(c: &mut Criterion) {
for file in get_files() {
group.throughput(Throughput::Bytes(file.source_text.len() as u64));
group.bench_with_input(BenchmarkId::from_parameter(&file.name), &file.source_text, |b, source_text| {
b.iter_with_large_drop(|| {
let allocator = Bump::default();
let mut lexer = Lexer::new(&allocator, source_text, Include::none());
b.iter(|| {
let mut lexer = Lexer::new(source_text, Include::none());
loop {
if matches!(lexer.advance().kind(), Kind::Eof) {
break;
}
}
allocator
});
});
}
Expand Down

0 comments on commit 0e765a3

Please sign in to comment.