Skip to content

Commit

Permalink
Add fast-float2 back to our benchmarks.
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexhuszagh committed Jan 11, 2025
1 parent 85d1e4a commit cc86245
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
13 changes: 13 additions & 0 deletions extras/benchmark/input.rs
Original file line number Diff line number Diff line change
Expand Up @@ -491,6 +491,18 @@ macro_rules! from_lexical_generator {
}};
}

macro_rules! from_fast_float2_generator {
($group:ident, $name:expr, $iter:expr, $t:ty) => {{
$group.bench_function($name, |bench| {
bench.iter(|| {
$iter.for_each(|x| {
black_box(fast_float2::parse::<$t, _>(x.as_bytes()).unwrap());
})
})
});
}};
}

macro_rules! str_parse_generator {
($group:ident, $name:expr, $iter:expr, $t:ty) => {{
$group.bench_function($name, |bench| {
Expand All @@ -506,6 +518,7 @@ macro_rules! str_parse_generator {
macro_rules! parse_float_generator {
($group:ident, $type:literal, $iter:expr, $t:ty) => {{
from_lexical_generator!($group, concat!("parse_", $type, "_lexical"), $iter, $t);
from_fast_float2_generator!($group, concat!("parse_", $type, "_fast_float2"), $iter, $t);
str_parse_generator!($group, concat!("parse_", $type, "_core"), $iter, $t);
}};
}
Expand Down
1 change: 1 addition & 0 deletions extras/benchmark/parse-float/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ features = []
criterion = { version = "0.5", features = ["html_reports"] }
fastrand = "2.1.0"
lazy_static = "1"
fast-float2 = "0.2"
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"

Expand Down

0 comments on commit cc86245

Please sign in to comment.