bindings/javascript: Add micro-benchmarks

This commit is contained in:
Pekka Enberg
2025-07-31 20:00:59 +03:00
parent 95b701aa1f
commit 773e4eed90
4 changed files with 549 additions and 0 deletions

View 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,
});