After years of being able to run SQLite on my mobile phone, my tv, my router and gaming consoles, I can finally run it on my browser. Which also happens to be running on the most powerful machine I own
Sqlite3 WebAssembly
41–50 of 200 posts
Re: Sqlite3 WebAssembly
#42Re: Sqlite3 WebAssembly
#43Something 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
#44Something 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…
Isn't a more advanced/production version of this what the combo of couchdb and pouchdb do since several years ago?
Re: Sqlite3 WebAssembly
#45[flagged]
Re: Sqlite3 WebAssembly
#46So 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.
In a regular compiler/linker scenario it would just be a static compilation. Here we have a JS app and WASM library.
Re: Sqlite3 WebAssembly
#47After years of being able to run SQLite on my mobile phone, my tv, my router and gaming consoles, I can finally run it on my browser. Which also happens to be running on the most powerful machine I own
surprise! it's been there for decades: https://en.wikipedia.org/wiki/Web_SQL_Database
Re: Sqlite3 WebAssembly
#48More specifically, would this be able to be a "replacement" for indexedDB? Does the data persist, or do I need to keep the sqlite file in the filesytemAPI (or indexedDB/localstorage) myself?
Re: Sqlite3 WebAssembly
#49So 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.
Is there a way to statically compile an application with SQLite and the result WASM was smaller. So for example I have an app that would use only a specific subset of SQLite. Could the SQLite's WASM be built with this in mind cutting down on code that is not used? Or is there a way to prune it having the used API surface? In a regular compiler/linker scenario it would just be a static compilation. Here we have a JS a…
Re: Sqlite3 WebAssembly
#50Earlier quoted context omitted.
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…
A megabyte here, a megabyte there, pretty soon you’re talking about a really heavyweight app.