mirror of
https://github.com/aljazceru/turso.git
synced 2026-02-09 10:14:21 +01:00
Add benchmarks for prepare()
This commit is contained in:
@@ -11,6 +11,18 @@ fn bench(c: &mut Criterion) {
|
||||
let db = Database::open_file(io.clone(), "../testing/testing.db").unwrap();
|
||||
let conn = db.connect();
|
||||
|
||||
group.bench_function("Prepare statement: 'SELECT 1'", |b| {
|
||||
b.iter(|| {
|
||||
conn.prepare("SELECT 1").unwrap();
|
||||
});
|
||||
});
|
||||
|
||||
group.bench_function("Prepare statement: 'SELECT * FROM users LIMIT 1'", |b| {
|
||||
b.iter(|| {
|
||||
conn.prepare("SELECT * FROM users LIMIT 1").unwrap();
|
||||
});
|
||||
});
|
||||
|
||||
let mut stmt = conn.prepare("SELECT 1").unwrap();
|
||||
group.bench_function("Execute prepared statement: 'SELECT 1'", |b| {
|
||||
let io = io.clone();
|
||||
@@ -84,6 +96,18 @@ fn bench(c: &mut Criterion) {
|
||||
|
||||
let conn = rusqlite::Connection::open("../testing/testing.db").unwrap();
|
||||
|
||||
group.bench_function("Prepare statement: 'SELECT 1'", |b| {
|
||||
b.iter(|| {
|
||||
conn.prepare("SELECT 1").unwrap();
|
||||
});
|
||||
});
|
||||
|
||||
group.bench_function("Prepare statement: 'SELECT * FROM users LIMIT 1'", |b| {
|
||||
b.iter(|| {
|
||||
conn.prepare("SELECT * FROM users LIMIT 1").unwrap();
|
||||
});
|
||||
});
|
||||
|
||||
let mut stmt = conn.prepare("SELECT 1").unwrap();
|
||||
group.bench_function("Execute prepared statement: 'SELECT 1'", |b| {
|
||||
b.iter(|| {
|
||||
|
||||
Reference in New Issue
Block a user