r/coolgithubprojects • u/web3samy • 6h ago
I started with an experiment JIT-compiling SQLite's bytecode. Now it's an engine faster than SQLite and Turso, with a self-hosted server that libSQL apps connect to unchanged
I started musql (pronounced muscle) to experiment with JIT-compiling SQLite's bytecode (the VDBE) to machine code. That turned into a SQLite-compatible engine. It's now faster than C SQLite and Turso in these read benchmarks, with 100,000 rows each:
| Query | musql | C SQLite | Turso |
|---|---|---|---|
| Filtered count | 20 µs | 6.22 ms | 18.7 ms |
| Sum over a filter | 36 µs | 6.76 ms | 22.3 ms |
| Grouped aggregate | 440 µs | 39.9 ms | 104 ms |
ORDER BY v DESC LIMIT 20 | 337 µs | 9.09 ms | 90.6 ms |
| Rowid lookup | 1 µs | 11.2 µs | 2.7 µs |
| Indexed join | 7 µs | 15.7 µs | 8 µs |
These are engine-only, in-process timings on an Intel Xeon running Linux, with disk-backed files and a warm cache. C SQLite and Turso run through their native C APIs. Lookups and joins gain much less than scans. Full results and method.
Recently I added musql/cloud, a cloud server you run yourself. It speaks the libSQL protocol, so an app using libsql client just needs a new URL and a token from the console. The code stays the same.
To run several nodes, list peers in the config and choose how each database replicates: raft or CRDT.
⭐ https://github.com/samyfodil/musql - If you try it with an existing database or app, I'd like to hear which queries or workflows give you trouble.









