4 ms·
WASM tasks shouldn’t need a full standard library. If you statically compile against any library it should only keep the pieces used.
by wibagusto 5y ago
WASM tasks shouldn’t need a full standard library. If you statically compile against any library it should only keep the pieces used.
- brundolf 5y agoThat's fair, but still, you'll be pulling in a lot of really fundamental stuff that JavaScript gets for free. String manipulation, fundamental data structures, iterators, HTTP, JSON (de)serialization, etc.
- mst 5y agoOne of the examples he mentioned was 200Kb. That's still a lot more than "a single file of javascript", certainly, but it's not that bad. Trade-offs all the way down, as ever.
- merb 5y agoI'm not sure but if you need any string manipulation at all it will be really hard to not use the rust std?
- brundolf 5y agoI think their point is that what's referred to as "tree-shaking" in the JS world is (I'm pretty sure) normal and standard for most statically-compiled languages like Rust. So you won't bring in anything you don't need, though you will still be bringing in lots of stuff you do need
- azakai 5y agoGenerally true, but just to add to that, in languages like Rust and C++ you often end up including stuff you don't need due to toolchain limitations. For example, indirect calls (from Rust traits or C++ virtual methods) are hard to get rid of in general. This is a pretty significant cause of bloat in practice, sadly, but toolchain improvements may help in the future. So for now, JS's advantage of the standard library being in the VM is pretty significant.