Skip to content

Add a sqlite3 benchmark#308

Merged
fitzgen merged 2 commits intobytecodealliance:mainfrom
fitzgen:sightglass-sqlite3-wasm
Apr 28, 2026
Merged

Add a sqlite3 benchmark#308
fitzgen merged 2 commits intobytecodealliance:mainfrom
fitzgen:sightglass-sqlite3-wasm

Conversation

@fitzgen
Copy link
Copy Markdown
Member

@fitzgen fitzgen commented Apr 25, 2026

A WebAssembly build of SQLite's official speedtest1.c benchmark program, ported from JetStream 3 for use with Sightglass.

Quoting from its description:

This program strives to exercise the SQLite library in a way that is typical
of real-world applications. Of course, every application is different, and so
no test program can exactly mirror the behavior of all applications.

Since SQLite is a very widely used database and provides an official and popular upstream WebAssembly port, this is a realistic, larger WebAssembly program.

Originally built from SQLite 3.48.0 with Emscripten SDK 3.1.73.

The original JetStream 3 module was compiled by Emscripten and paired with a JavaScript driver. Since sightglass does not use JavaScript, the module was modified to:

  • Remove Emscripten "env" imports and replace them with stubs (except emscripten_resize_heap, which delegates to memory.grow).
  • Add "bench" "start" and "bench" "end" imports for Sightglass timing.
  • Add a "_start" export that calls __wasm_call_ctors, bench.start, wasm_main, and bench.end.
  • Execute the sqlite3 benchmarks with szTest=25 instead of szTest=100, bringing a default run under Sightglass from ~4 minutes to ~1 minute.

@fitzgen fitzgen requested a review from posborne April 25, 2026 17:16
@fitzgen
Copy link
Copy Markdown
Member Author

fitzgen commented Apr 27, 2026

FWIW, the "benchmarks" CI job is failing on main; not related to this PR.

Copy link
Copy Markdown
Collaborator

@posborne posborne left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @fitzgen

fitzgen added 2 commits April 28, 2026 09:25
A WebAssembly build of SQLite's official `speedtest1.c` benchmark program,
ported from [JetStream 3](https://github.com/WebKit/JetStream/tree/main/sqlite3)
for use with Sightglass.

Quoting from [its description](https://sqlite.org/cpu.html):

> This program strives to exercise the SQLite library in a way that is typical
> of real-world applications. Of course, every application is different, and so
> no test program can exactly mirror the behavior of all applications.

Since SQLite is a very widely used database and provides an official and popular
upstream WebAssembly port, this is a realistic, larger WebAssembly program.

Originally built from SQLite 3.48.0 with Emscripten SDK 3.1.73.

The original JetStream 3 module was compiled by Emscripten and paired with a
JavaScript driver. Since sightglass does not use JavaScript, the module was
modified to:

- Remove Emscripten `"env"` imports and replace them with stubs (except
  `emscripten_resize_heap`, which delegates to `memory.grow`).
- Add `"bench" "start"` and `"bench" "end"` imports for Sightglass timing.
- Add a `"_start"` export that calls `__wasm_call_ctors`, `bench.start`,
  `wasm_main`, and `bench.end`.
- Execute the sqlite3 benchmarks with `szTest=25` instead of `szTest=100`,
  bringing a default run under Sightglass from ~4 minutes to ~1 minute.
@fitzgen fitzgen force-pushed the sightglass-sqlite3-wasm branch from 6061781 to d6e434d Compare April 28, 2026 16:25
@fitzgen fitzgen merged commit 789ac09 into bytecodealliance:main Apr 28, 2026
16 checks passed
@fitzgen fitzgen deleted the sightglass-sqlite3-wasm branch April 28, 2026 16:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants