Disable benches by default

This commit is contained in:
gwenn 2020-03-08 16:14:04 +01:00
parent 8ddacbb27c
commit 0edc91e8ef
2 changed files with 22 additions and 17 deletions

View File

@ -56,6 +56,7 @@ series = ["vtab"]
# check for invalid query.
extra_check = []
modern_sqlite = ["libsqlite3-sys/bundled_bindings"]
unstable = []
[dependencies]
time = "0.1.0"

View File

@ -1,20 +1,24 @@
#![feature(test)]
extern crate test;
#![cfg_attr(feature = "unstable", feature(test))]
use rusqlite::Connection;
use test::Bencher;
#[cfg(feature = "unstable")]
mod bench {
extern crate test;
#[bench]
fn bench_no_cache(b: &mut Bencher) {
use rusqlite::Connection;
use test::Bencher;
#[bench]
fn bench_no_cache(b: &mut Bencher) {
let db = Connection::open_in_memory().unwrap();
db.set_prepared_statement_cache_capacity(0);
let sql = "SELECT 1, 'test', 3.14 UNION SELECT 2, 'exp', 2.71";
b.iter(|| db.prepare(sql).unwrap());
}
}
#[bench]
fn bench_cache(b: &mut Bencher) {
#[bench]
fn bench_cache(b: &mut Bencher) {
let db = Connection::open_in_memory().unwrap();
let sql = "SELECT 1, 'test', 3.14 UNION SELECT 2, 'exp', 2.71";
b.iter(|| db.prepare_cached(sql).unwrap());
}
}