Skip to content

Commit

Permalink
Increment the itoa benchmark versions.
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexhuszagh committed Sep 18, 2024
1 parent 5b4224f commit 21021cb
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 8 deletions.
9 changes: 2 additions & 7 deletions lexical-benchmark/input.rs
Original file line number Diff line number Diff line change
Expand Up @@ -449,16 +449,11 @@ macro_rules! ryu_generator {

macro_rules! itoa_generator {
($group:ident, $name:expr, $iter:expr) => {{
use lexical_util::constants::BUFFER_SIZE;
let mut buffer = vec![b'0'; BUFFER_SIZE];
let mut buffer = itoa::Buffer::new();
$group.bench_function($name, |bench| {
bench.iter(|| {
$iter.for_each(|&x| {
itoa::write(&mut buffer, x).unwrap();
black_box(&buffer);
unsafe {
buffer.set_len(0);
}
black_box(buffer.format(x));
})
})
});
Expand Down
2 changes: 1 addition & 1 deletion lexical-benchmark/write-integer/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ features = []

[dev-dependencies]
criterion = { version = "0.5.0", features = ["html_reports"] }
itoa = { version = "0.4", features = ["i128"] }
itoa = { version = "1.0.11" }
fastrand = "2.1.0"
lazy_static = "1"
serde = { version = "1.0", features = ["derive"] }
Expand Down

0 comments on commit 21021cb

Please sign in to comment.