mirror of
https://github.com/aljazceru/turso.git
synced 2025-12-29 05:54:21 +01:00
This adds a benchmark for "SELECT 1" that essentially just evaluates the overhead of calling into the library. Looks like WebAssembly adds 2.5x overhead compared to native code... ``` penberg@vonneumann perf % node perf-limbo.js cpu: Apple M1 runtime: node v18.19.0 (arm64-darwin) benchmark time (avg) (min … max) p75 p99 p999 ------------------------------------------------- ----------------------------- • Statement ------------------------------------------------- ----------------------------- SELECT 1 771 ns/iter (624 ns … 2'183 µs) 750 ns 1'085 ns 1'750 ns summary for Statement SELECT 1 penberg@vonneumann perf % node perf-better-sqlite3.js cpu: Apple M1 runtime: node v18.19.0 (arm64-darwin) benchmark time (avg) (min … max) p75 p99 p999 ------------------------------------------------- ----------------------------- • Statement ------------------------------------------------- ----------------------------- SELECT 1 302 ns/iter (166 ns … 779 µs) 292 ns 375 ns 1'000 ns summary for Statement SELECT 1 ```
24 lines
384 B
JavaScript
24 lines
384 B
JavaScript
import { run, bench, group, baseline } from 'mitata';
|
|
|
|
import Database from 'better-sqlite3';
|
|
|
|
const db = new Database('limbo.db');
|
|
|
|
const stmt = db.prepare("SELECT 1");
|
|
|
|
group('Statement', () => {
|
|
bench('SELECT 1', () => {
|
|
stmt.all();
|
|
});
|
|
});
|
|
|
|
await run({
|
|
units: false,
|
|
silent: false,
|
|
avg: true,
|
|
json: false,
|
|
colors: true,
|
|
min_max: true,
|
|
percentiles: true,
|
|
});
|