mirror of
https://github.com/salsa-rs/salsa.git
synced 2025-01-22 12:56:33 +00:00
Fix benchmarks accidentally re-using the same database
This commit is contained in:
parent
32bd57c23f
commit
418e6ea838
1 changed files with 4 additions and 3 deletions
|
@ -26,9 +26,8 @@ fn mutating_inputs(c: &mut Criterion) {
|
|||
codspeed_criterion_compat::measurement::WallTime,
|
||||
> = c.benchmark_group("Mutating Inputs");
|
||||
|
||||
let mut db = salsa::DatabaseImpl::default();
|
||||
|
||||
for n in &[10, 20, 30] {
|
||||
let mut db = salsa::DatabaseImpl::default();
|
||||
let base_string = "hello, world!".to_owned();
|
||||
let base_len = base_string.len();
|
||||
|
||||
|
@ -57,7 +56,6 @@ fn inputs(c: &mut Criterion) {
|
|||
> = c.benchmark_group("Mutating Inputs");
|
||||
|
||||
let db = salsa::DatabaseImpl::default();
|
||||
|
||||
group.bench_function(BenchmarkId::new("new", "InternedInput"), |b| {
|
||||
b.iter(|| {
|
||||
let input: InternedInput = InternedInput::new(&db, "hello, world!".to_owned());
|
||||
|
@ -65,6 +63,7 @@ fn inputs(c: &mut Criterion) {
|
|||
})
|
||||
});
|
||||
|
||||
let db = salsa::DatabaseImpl::default();
|
||||
group.bench_function(BenchmarkId::new("amortized", "InternedInput"), |b| {
|
||||
let input = InternedInput::new(&db, "hello, world!".to_owned());
|
||||
let _ = interned_length(&db, input);
|
||||
|
@ -72,6 +71,7 @@ fn inputs(c: &mut Criterion) {
|
|||
b.iter(|| interned_length(&db, input));
|
||||
});
|
||||
|
||||
let db = salsa::DatabaseImpl::default();
|
||||
group.bench_function(BenchmarkId::new("new", "Input"), |b| {
|
||||
b.iter(|| {
|
||||
let input = Input::new(&db, "hello, world!".to_owned());
|
||||
|
@ -79,6 +79,7 @@ fn inputs(c: &mut Criterion) {
|
|||
})
|
||||
});
|
||||
|
||||
let db = salsa::DatabaseImpl::default();
|
||||
group.bench_function(BenchmarkId::new("amortized", "Input"), |b| {
|
||||
let input = Input::new(&db, "hello, world!".to_owned());
|
||||
let _ = length(&db, input);
|
||||
|
|
Loading…
Reference in a new issue