Revert "add benchmark for vec cache"

This reverts commit 82ed288dc5.
This commit is contained in:
Damien Elmes 2020-03-29 09:16:11 +10:00
parent ef79f7d676
commit 1a1a00d50f
3 changed files with 0 additions and 43 deletions

View file

@ -5,9 +5,6 @@ edition = "2018"
authors = ["Ankitects Pty Ltd and contributors"] authors = ["Ankitects Pty Ltd and contributors"]
license = "AGPL-3.0-or-later" license = "AGPL-3.0-or-later"
[features]
unstable = []
[dependencies] [dependencies]
nom = "5.0.1" nom = "5.0.1"
failure = "0.1.7" failure = "0.1.7"

View file

@ -2,7 +2,6 @@
// License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html // License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
#![deny(unused_must_use)] #![deny(unused_must_use)]
#![cfg_attr(feature = "unstable", feature(test))]
mod backend_proto; mod backend_proto;

View file

@ -381,42 +381,3 @@ impl StorageContext<'_> {
Ok(*self.timing_today.as_ref().unwrap()) Ok(*self.timing_today.as_ref().unwrap())
} }
} }
#[cfg(all(feature = "unstable", test))]
mod bench {
extern crate test;
use super::{CachedStatementKind, SqliteStorage};
use std::path::Path;
use test::Bencher;
const SQL: &str = "insert or replace into cards
(id, nid, did, ord, mod, usn, type, queue, due, ivl, factor,
reps, lapses, left, odue, odid, flags, data)
values
(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)";
#[bench]
fn bench_no_cache(b: &mut Bencher) {
let storage = SqliteStorage::open_or_create(Path::new(":memory:")).unwrap();
b.iter(|| storage.db.prepare(SQL).unwrap());
}
#[bench]
fn bench_hash_cache(b: &mut Bencher) {
let storage = SqliteStorage::open_or_create(Path::new(":memory:")).unwrap();
b.iter(|| storage.db.prepare_cached(SQL).unwrap());
}
#[bench]
fn bench_vec_cache(b: &mut Bencher) {
let storage = SqliteStorage::open_or_create(Path::new(":memory:")).unwrap();
let mut ctx = storage.context(false);
b.iter(|| {
ctx.with_cached_stmt(CachedStatementKind::GetCard, SQL, |_stmt| {
test::black_box(_stmt);
Ok(())
})
.unwrap()
});
}
}