mirror of
https://github.com/isar/rusqlite.git
synced 2025-08-19 12:29:34 +08:00
Fix clippy warnings
And fix bench.
This commit is contained in:
@@ -4,12 +4,12 @@ extern crate test;
|
||||
extern crate rusqlite;
|
||||
|
||||
use rusqlite::Connection;
|
||||
use rusqlite::cache::StatementCache;
|
||||
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());
|
||||
}
|
||||
@@ -17,7 +17,6 @@ fn bench_no_cache(b: &mut Bencher) {
|
||||
#[bench]
|
||||
fn bench_cache(b: &mut Bencher) {
|
||||
let db = Connection::open_in_memory().unwrap();
|
||||
let cache = StatementCache::new(&db, 15);
|
||||
let sql = "SELECT 1, 'test', 3.14 UNION SELECT 2, 'exp', 2.71";
|
||||
b.iter(|| cache.get(sql).unwrap());
|
||||
b.iter(|| db.prepare_cached(sql).unwrap());
|
||||
}
|
||||
|
Reference in New Issue
Block a user