-
Notifications
You must be signed in to change notification settings - Fork 17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
wasm build? #5
Comments
Ah, I just saw: https://github.com/asg017/sqlite-loadable-rs#probably-cant-be-compiled-into-wasm josephg seemed to think compiling a rust dependency into a c library and targeting WASM would be possible: vlcn-io/cr-sqlite#65 (comment) Haven't tried myself yet, however. |
From what I've tried, compiling it to a staticlib (aka What I think is the solution is the But I think Also, the problem with WASM SQLite extensions is that they must be statically linked into the SQLite WASM module to be used - which means forking sql.js or forking the official SQLite WASM module. There's no way to dynamically load extensions into an already-compiled SQLite module. It's not a dealbreaker necessarily, but it does make it very difficult to work with. I also imagine that the binary size of an extension written with |
Yep, I've forked the official SQLite build in order to bundle my extensions into a WASM distribution. Wish there was a better way..
mainly just due to rust standard library inclusion? How big is a bare bones |
A compiled "hello world" in Rust with sqlite-loadable-rs is 496KB, compared to C's 17KB. That's on my mac tho, as a dynamic library, so I'm unsure how big a static library in WASM would be. I think SQLite WASM is something like 700-900KB by itself I dont think Rust includes the entire standard library by default (rather |
If you compile to wasm with Diamond types in wasm is currently 255KB. That includes a lot of stuff from rust's std (including malloc), my custom b-tree implementation, jumprope (a skip list implementation) and my custom binary encoder & decoder for text CRDTs (which is bigger than it should be). With brotli compression that drops to 83kb. Its also worth remembering that modern browsers decode wasm binaries much faster than they decode javascript - usually faster than the network can go. |
@josephg this is extemely useful information, thanks for sharing! Really cool to here about Will give compiling |
I got WASM LLVM bitcode generated by cargo to link to a SQLite WASM build today. Going to try actually invoking the function next 🤞 Here is what I did:
which compiled with no errors 🎉 I'll see if I can strip this down to minimal bits ahead of our conversation and actually get that function invoked from sqlite. Also -- should we move this discussion to https://github.com/asg017/sqlite-loadable-rs ? |
minimal demo repo: https://github.com/tantaman/sqlite-rust-wasm Seems like it all works :) Now to try building |
Hi, i Have interesse in this project. |
Just a question -- have you been able to compile a Rust loadable extension into the WASM build of SQLite?
The text was updated successfully, but these errors were encountered: