Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve and extend translation benchmarks #1227

Merged
merged 2 commits into from
Oct 6, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 21 additions & 13 deletions crates/wasmi/benches/benches.rs
Original file line number Diff line number Diff line change
Expand Up @@ -156,24 +156,24 @@ fn bench_translate_for(
c: &mut Criterion,
name: &str,
path: &str,
validation: Validation,
mode: CompilationMode,
validation: Validation,
fuel_metering: FuelMetering,
) {
let validation_id = match validation {
Validation::Checked => "checked",
Validation::Unchecked => "unchecked",
};
let mode_id = match mode {
CompilationMode::Eager => "eager",
CompilationMode::LazyTranslation => "lazy-translation",
CompilationMode::Lazy => "lazy",
};
let validation_id = match validation {
Validation::Checked => "checked",
Validation::Unchecked => "unchecked",
};
let fuel_id = match fuel_metering {
FuelMetering::Enabled => "fuel",
FuelMetering::Disabled => "default",
FuelMetering::Enabled => "+metered",
FuelMetering::Disabled => "",
};
let bench_id = format!("translate/{name}/{validation_id}/{mode_id}/{fuel_id}");
let bench_id = format!("translate/{name}/{mode_id}/{validation_id}{fuel_id}");
c.bench_function(&bench_id, |b| {
let mut config = bench_config();
if matches!(fuel_metering, FuelMetering::Enabled) {
Expand Down Expand Up @@ -202,40 +202,48 @@ fn bench_translate_for_all(c: &mut Criterion, name: &str, path: &str) {
c,
name,
path,
Validation::Checked,
CompilationMode::Eager,
Validation::Checked,
FuelMetering::Disabled,
);
bench_translate_for(
c,
name,
path,
Validation::Checked,
CompilationMode::Eager,
Validation::Checked,
FuelMetering::Enabled,
);
bench_translate_for(
c,
name,
path,
Validation::Checked,
CompilationMode::LazyTranslation,
CompilationMode::Eager,
Validation::Unchecked,
FuelMetering::Disabled,
);
bench_translate_for(
c,
name,
path,
CompilationMode::LazyTranslation,
Validation::Checked,
FuelMetering::Disabled,
);
bench_translate_for(
c,
name,
path,
CompilationMode::Lazy,
Validation::Checked,
FuelMetering::Disabled,
);
bench_translate_for(
c,
name,
path,
CompilationMode::Lazy,
Validation::Unchecked,
CompilationMode::Eager,
FuelMetering::Disabled,
);
}
Expand Down
Loading