mirror of
https://github.com/aljazceru/turso.git
synced 2025-12-18 17:14:20 +01:00
bindings/javascript: Add micro-benchmarks
This commit is contained in:
26
bindings/javascript/perf/perf-turso.js
Normal file
26
bindings/javascript/perf/perf-turso.js
Normal file
@@ -0,0 +1,26 @@
|
||||
import { run, bench, group, baseline } from 'mitata';
|
||||
|
||||
import Database from '@tursodatabase/turso';
|
||||
|
||||
const db = new Database(':memory:');
|
||||
|
||||
db.exec("CREATE TABLE users (id INTEGER PRIMARY KEY, name TEXT, email TEXT)");
|
||||
db.exec("INSERT INTO users (id, name, email) VALUES (1, 'Alice', 'alice@example.org')");
|
||||
|
||||
const stmt = db.prepare("SELECT * FROM users WHERE id = ?");
|
||||
|
||||
group('Statement', () => {
|
||||
bench('Statement.get() bind parameters', () => {
|
||||
stmt.get(1);
|
||||
});
|
||||
});
|
||||
|
||||
await run({
|
||||
units: false,
|
||||
silent: false,
|
||||
avg: true,
|
||||
json: false,
|
||||
colors: true,
|
||||
min_max: true,
|
||||
percentiles: true,
|
||||
});
|
||||
Reference in New Issue
Block a user