So after downloading from the official downloads page and stripping away all the mjs files and "bundler-friendly" files, a minimal sqlite wasm dependency will be about 1.3MB. For an in-browser app, that seems a bit much but of course wasm runs in other places these days where it might make more sense.
1.3MB seems perfectly reasonable in a modern web app, especially since it will be cached after the first visit to the site. If you’re just storing user preferences, obviously don’t download SQLite for your web app just to do that… but if you’re doing something that benefits from a full database, don’t fret so much about 1MB that you go try to reinvent the wheel for no reason. If the other comment is correct, then it…
Sqlite3 WebAssembly
31–40 of 200 posts
Re: Sqlite3 WebAssembly
#32Then on subsequent visits use that server-side data to rehydrate the client-side database.
From https://sqlite.org/forum/info/50a4bfdb294333eec1ba4749661934... is looks like WAL mode is excluded from the default SQLite WASM build so you would have to go custom with that.
Re: Sqlite3 WebAssembly
#33As a general question, in what scenarios is it more beneficial to send the full DB and let the browser handle the queries? Maybe phrased a better way - when would I use this to improve a user experience over the traditional server-hosted db model?
just my intuition when I read the headline of this post - something like the interplay between PouchDB and CouchDB for offline first apps
https://medium.com/offline-camp/couchdb-pouchdb-and-hoodie-a...
Re: Sqlite3 WebAssembly
#34As a general question, in what scenarios is it more beneficial to send the full DB and let the browser handle the queries? Maybe phrased a better way - when would I use this to improve a user experience over the traditional server-hosted db model?
Re: Sqlite3 WebAssembly
#35(Previously discussed 7 months ago: https://news.ycombinator.com/item?id=39477457)
Re: Sqlite3 WebAssembly
#36Something that would be really fun would be to run SQLite in-memory in a browser but use the same tricks as Litestream and Cloudflare Durable Objects ( https://simonwillison.net/2024/Oct/13/zero-latency-sqlite-st... ) to stream a copy of the WAL log to a server (maybe over a WebSocket, though intermittent fetch() POST would work too). Then on subsequent visits use that server-side data to rehydrate the client-side da…
Re: Sqlite3 WebAssembly
#37How long until we see WebAssembly/WebGPU become a platform independent choice for deploying server side code as well?
as soon as wasi is settled
wow I didn't know this was a thing. thanks for filling me in!
Re: Sqlite3 WebAssembly
#38I was trying to get this working in a rust ecosystem some time ago but none of the blessed.rs sql (rusqlite, sqlx) wrappers seem to take advantage of it yet and wrapping it yourself is a bit tricky since when I was trying I couldn't figure out a way to to get emscripten wasm code to play nice with wasm32-unknown-unknown without some kind of JS wrapper which then requires implementing the interface those crates expect…
Re: Sqlite3 WebAssembly
#39It's more of an experiment than an attempt to make something production ready, though I could see it being useful to bring dependency-less sqlite tooling to the JVM ecosystem.
Re: Sqlite3 WebAssembly
#40How long until we see WebAssembly/WebGPU become a platform independent choice for deploying server side code as well?