From 1a1a00d50f72a5e20944489818866e1d5de7ad03 Mon Sep 17 00:00:00 2001 From: Damien Elmes Date: Sun, 29 Mar 2020 09:16:11 +1000 Subject: [PATCH] Revert "add benchmark for vec cache" This reverts commit 82ed288dc53fda9d2dc47046727b43d2c3685e53. --- rslib/Cargo.toml | 3 --- rslib/src/lib.rs | 1 - rslib/src/storage/sqlite.rs | 39 ------------------------------------- 3 files changed, 43 deletions(-) diff --git a/rslib/Cargo.toml b/rslib/Cargo.toml index a3163bb79..4cdf2491a 100644 --- a/rslib/Cargo.toml +++ b/rslib/Cargo.toml @@ -5,9 +5,6 @@ edition = "2018" authors = ["Ankitects Pty Ltd and contributors"] license = "AGPL-3.0-or-later" -[features] -unstable = [] - [dependencies] nom = "5.0.1" failure = "0.1.7" diff --git a/rslib/src/lib.rs b/rslib/src/lib.rs index 02a040cf9..87253f998 100644 --- a/rslib/src/lib.rs +++ b/rslib/src/lib.rs @@ -2,7 +2,6 @@ // License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html #![deny(unused_must_use)] -#![cfg_attr(feature = "unstable", feature(test))] mod backend_proto; diff --git a/rslib/src/storage/sqlite.rs b/rslib/src/storage/sqlite.rs index 6a07c3d05..a4e2b11a7 100644 --- a/rslib/src/storage/sqlite.rs +++ b/rslib/src/storage/sqlite.rs @@ -381,42 +381,3 @@ impl StorageContext<'_> { 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() - }); - } -}