Benchmark execute vs execute_batch

This commit is contained in:
gwenn 2020-06-27 09:54:33 +02:00
parent dd886578d2
commit 3cea0c7af5
2 changed files with 21 additions and 0 deletions

View File

@ -135,6 +135,10 @@ name = "vtab"
name = "cache" name = "cache"
harness = false harness = false
[[bench]]
name = "exec"
harness = false
[package.metadata.docs.rs] [package.metadata.docs.rs]
features = [ "backup", "blob", "chrono", "collation", "functions", "limits", "load_extension", "serde_json", "trace", "url", "vtab", "window", "modern_sqlite", "column_decltype" ] features = [ "backup", "blob", "chrono", "collation", "functions", "limits", "load_extension", "serde_json", "trace", "url", "vtab", "window", "modern_sqlite", "column_decltype" ]
all-features = false all-features = false

17
benches/exec.rs Normal file
View File

@ -0,0 +1,17 @@
use bencher::{benchmark_group, benchmark_main, Bencher};
use rusqlite::{Connection, NO_PARAMS};
fn bench_execute(b: &mut Bencher) {
let db = Connection::open_in_memory().unwrap();
let sql = "PRAGMA user_version=1";
b.iter(|| db.execute(sql, NO_PARAMS).unwrap());
}
fn bench_execute_batch(b: &mut Bencher) {
let db = Connection::open_in_memory().unwrap();
let sql = "PRAGMA user_version=1";
b.iter(|| db.execute_batch(sql).unwrap());
}
benchmark_group!(exec_benches, bench_execute, bench_execute_batch);
benchmark_main!(exec_benches);