How we sped up Notion in the browser with WASM SQLite
1–10 of 107 posts
Re: How we sped up Notion in the browser with WASM SQLite
#2Discussion (19 points, yesterday) https://news.ycombinator.com/item?id=40931957
Re: How we sped up Notion in the browser with WASM SQLite
#3Re: How we sped up Notion in the browser with WASM SQLite
#4- tooling, support and debugging for opfs
- only really works with a single worker using sync api, but this is not available from service workers
- the official js releases are really not idiomatic js and require in depth understanding to pick out the right parts and then build a usable layer on top, afaik there is no existing npm package that just provides what is required
Re: How we sped up Notion in the browser with WASM SQLite
#5[1] https://hacks.mozilla.org/2010/06/beyond-html5-database-apis...
Re: How we sped up Notion in the browser with WASM SQLite
#6There's a multiple readers and writers proposal [0]. It's been "position: positive" by Firefox [1], implemented in Chrome [2], and ignored by Webkit [3] (of course).
0: https://github.com/whatwg/fs/blob/main/proposals/MultipleReadersWriters.md
1: https://github.com/mozilla/standards-positions/issues/861
2: https://chromestatus.com/feature/5172892632875008
3: https://github.com/WebKit/standards-positions/issues/238
Love the shoutout to Roy Hashimoto. He's been writing VFSs for SQLite-on-the-browser and perf testing them. He's recently wrote "IDBMirrorVFS", which "is a new example VFS that keeps all SQLite files in memory while persisting to IndexedDB". It has remarkable performance, of course. https://github.com/rhashimoto/wa-sqlite/discussions/189Also, looks like Roy takes advantage of the aforementioned proposal when he wrote `OPFSPermutedVFS`, which takes 2nd pace behind `IDBMirrorVFS` w/r/t perf. https://github.com/rhashimoto/wa-sqlite/blob/master/src/exam...
Re: How we sped up Notion in the browser with WASM SQLite
#7I believe it's a missed opportunity not to bundle sqlite in major browsers. I understand that making SQLite part of the browser spec introduces all sorts of complications [1] down the line. But nevertheless, it would have proved to be quite a nifty tool. [1] https://hacks.mozilla.org/2010/06/beyond-html5-database-apis...
Re: How we sped up Notion in the browser with WASM SQLite
#8I believe it's a missed opportunity not to bundle sqlite in major browsers. I understand that making SQLite part of the browser spec introduces all sorts of complications [1] down the line. But nevertheless, it would have proved to be quite a nifty tool. [1] https://hacks.mozilla.org/2010/06/beyond-html5-database-apis...
They already did that. It was called WebSQL. It was removed I think in favor of IndexedDB.
Mozilla again.. The real joke is, Firefox is now the only(?) browser using sqlite out-of-the-box for internal databases.
Re: How we sped up Notion in the browser with WASM SQLite
#9Re: How we sped up Notion in the browser with WASM SQLite
#10Meanwhile in AWS you would pay $27k a month to have the same IOPS as a Lenovo Thinkpad X1.
I just got done with a side project using WASM SQLite as well, it's incredibly powerful, even supports full text search.
My project "cluttr" is a local first site that focuses on cleaning up your screen shots folder and making it searchable via OCR. All in browser.
It also supports using Ollama to run a vision model against your images to provide more context.
Really helpful if you take a lot of screenshots for clients or PMs and need to find them later. The best part is 99% of the hosting cost is offloaded to the client, so I am not really worried about a large server bill.
(working on deployment to https://cluttr.ai later today)