Re:Postgres WASM
by justinclift on Monday October 03, 2022 @01:35PM
(#33070882)
Have you looked at compressing that ~16MB wasm file with something like Brotli?
When I was actively doing stuff with wasm (~2019), Brotli was the best compression approach. eg 16MB uncompressed -> 2.4MB compressed
https://github.com/golang/go/wiki/WebAssembly#reducing-the-s...
Re:Postgres WASM
by pistoriusp on Monday October 03, 2022 @02:36PM
(#33071770)
Our demo is on Netlify, so I'm assuming that they've got gzip or something along those lines enabled.
On my 50mbit/s (Germany :/) connection it's ~2 seconds
Zstandard is able to compress this file to 1.4MB.
a2b67f25.bin : 8.26% (16777216 => 1386514 bytes, a2b67f25.bin.zst)brotli compresses it to 1047967 bytes. And you can serve it as-is with Content-Encoding: br, unlike zstd.
(zstd at --ultra -22 level: 1149751 bytes).
Why is Brotli more efficient on Wasm files? I believe their built-in dictionary was tuned for HTML, CSS and JS content.
I'd guess that the context model (based on last 1-2 bytes) can be used to separate opcodes and their parameters.
Nice, I wonder if anyone has got Django with postgres working in this environment?
Re:Postgres WASM
by collinmanderson on Monday October 03, 2022 @10:31PM
(#33076147)
PyScript ( https://pyscript.net ) recently came out, though I don't know if Django works with it yet.
Re:Postgres WASM
by pistoriusp on Monday October 03, 2022 @03:05PM
(#33072175)
I don't see why it wouldn't work! You can exit pg and try it out :P
Didn't realize you guys are in SA. Hi from Stellenbosch. Cool to see more South Africans here and in the startup community in general.
Re:Postgres WASM
by pistoriusp on Tuesday October 04, 2022 @07:10AM
(#33078754)
o/
> If anyone out there wants to work on an open source version of this full-time please reach out to me. [0]
Paul reached out and we started working on it almost immediately. Check out the repo here: https://github.com/snaplet/postgres-wasm
We have a blog post about some of the interesting technical challenges that we faced whilst building this: https://www.snaplet.dev/post/postgresql-in-the-browser
Like most things, this is built on-top of the amazing open-source projects that made this possible, but special mention goes to v86.js and buildroot. We just glued it together.
My hope is that we as a community can own this project and make PostgresQL, and the software that runs on it, accessible to a larger audience.
---
[0] Request for collaboration: https://news.ycombinator.com/item?id=32500526