r/coolgithubprojects • • 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:

QuerymusqlC SQLiteTurso
Filtered count20 µs6.22 ms18.7 ms
Sum over a filter36 µs6.76 ms22.3 ms
Grouped aggregate440 µs39.9 ms104 ms
ORDER BY v DESC LIMIT 20337 µs9.09 ms90.6 ms
Rowid lookup1 µs11.2 µs2.7 µs
Indexed join7 µs15.7 µs8 µ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.

1 Upvotes

0 comments sorted by