Skip to content

Commit

Permalink
Merge pull request #667 from ChayimFriedman2/fix-benches
Browse files Browse the repository at this point in the history
Fix benchmarks
  • Loading branch information
MichaReiser authored Feb 4, 2025
2 parents 88dc597 + 3e5e3cb commit 75c5337
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions benches/compare.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,13 @@ fn inputs(c: &mut Criterion) {

group.bench_function(BenchmarkId::new("new", "InternedInput"), |b| {
b.iter_batched_ref(
salsa::DatabaseImpl::default,
|| {
let db = salsa::DatabaseImpl::default();
// Prepopulate ingredients.
let input = InternedInput::new(&db, "hello, world!".to_owned());
interned_length(&db, input);
db
},
|db| {
let input: InternedInput = InternedInput::new(db, "hello, world!".to_owned());
interned_length(db, input);
Expand Down Expand Up @@ -95,7 +101,13 @@ fn inputs(c: &mut Criterion) {

group.bench_function(BenchmarkId::new("new", "Input"), |b| {
b.iter_batched_ref(
salsa::DatabaseImpl::default,
|| {
let db = salsa::DatabaseImpl::default();
// Prepopulate ingredients.
let input = Input::new(&db, "hello, world!".to_owned());
length(&db, input);
db
},
|db| {
let input = Input::new(db, "hello, world!".to_owned());
length(db, input);
Expand Down

0 comments on commit 75c5337

Please sign in to comment.