2 ms·
Thanks. That's a really excellent way to describe things, probably the best comment on this thread. There's always a tradeoff between how much intelligence you
by repolfx 8y ago
Thanks. That's a really excellent way to describe things, probably the best comment on this thread.
There's always a tradeoff between how much intelligence you put into a runtime vs how much you have to ship with the app. In the limit WASM would turn into "download and run an entire language runtime with every web page", which is clearly suboptimal. Most likely compilation to JS will continue for the forseeable future when possible for that reason.
One idea that could probably work very well is to write a WASM interpreter for GraalVM. GraalVM has very high level constructs but can also support low level manually memory managed code. They have one for LLVM bitcode already, but WASM would probably be simpler to implement and with a more stable bytecode format. Then C/Rust/exceptionless C++ could ship artifacts as WASM files, scripting languages can ship source code, static managed languages like Java or Haskell (eta) can ship JARs, and they can all interoperate and be compiled together.
I don't see a route to getting there with current WASM runtimes or just the existing featureset of WASM though. As a portable ISA for distribution of limited, OS neutral C-ish libraries it seems reasonable enough. As a future VM for everything I can't see them beating GraalVM anytime soon. GraalVM has the shared high level constructs, but it is able to also (eventually) compile low level WASM/LLVM style code down to what a typical GCC like compiler would create.
- nine_k 8y agoRe shipping runtimes: caching exists. Right now you likely don't download a copy of jQuery, or React, or many other common libraries normally used on web pages. You have a few versions of them cached, and most of the time, there is a cache hit. I suppose the same will be true for WASM "runtimes" required by commonly used languages: you will have 2-3 major versions of them (think Python 2 vs Python 3), and an automatic update when a new version is released. Much like common JS libraries or fonts, these will be on CDNs, so they'll be fast more-or-less local downloads.