7 ms·
I'm sure there's a good reason for this and I just don't know it: what's the advantage of wasm over the JVM; i.e. why not just use the JVM in the browser? I as
by deeg 8y ago
I'm sure there's a good reason for this and I just don't know it: what's the advantage of wasm over the JVM; i.e. why not just use the JVM in the browser?
I assume there are complexities in compiling C/C++ to the JVM but wouldn't wasm have many of the same issues?
- feniv 8y agoThe WebAssembly format is better designed to be served over the web (compact representation, streaming compilation, low startup overhead, etc.) There's a discussion thread on this topic in the WebAssembly github: https://github.com/WebAssembly/design/issues/960 https://github.com/WebAssembly/design/issues/960
- kodablah 8y agoWaiting for @steveklabnik to write his post on this as it comes up in all of these threads. To give you a brief answer, the JVM bytecode is tied to JVM OO use cases and carries with it a significant runtime library burden. There are many many other details I can give you about how JVM bytecode is tailored to Java the language, but suffice to say it is not simple and not generic.
- steveklabnik 8y agoI’m hoping to get that out next week. I just gave a talk in Barcelona about wasm today, so that took up all my time.
- varjag 8y agoJVM sucks as a platform for anything but Java family languages. The execution model (no lexical binding, 64Kb code jump segmenting, inadequate rigid primitives type system) make running any decently modern language a pain. It's the reason a language like Clojure will never have a sensible backtrace. People do an honest effort with that but it's really polishing a turd.
- repolfx 8y agoBut wasm doesn't do exceptions at all, nor does it have a GC, so it's very far from being able to generate a stack trace through Lisp code. You don't seem to be comparing like with like. Bytecode has its flaws but the trend is away from using bytecode for all languages and towards partial evaluation of AST interpreters. That works well for managed OO like languages, and also other managed scripting languages, and it can also run C/C++/Rust/FORTRAN etc, with interop between the languages. WASM has no real roadmap to get to running anything other than small, manually memory managed programs. It's being billed as "generic" but I don't see it. GraalVM is generic. WASM struggles to run anything that requires a more sophisticated runtime than malloc.
- vardump 8y ago> WASM has no real roadmap to get to running anything other than small, manually memory managed programs. You mean small software like AutoCAD? https://web.autocad.com/ https://web.autocad.com/ > GraalVM is generic. How well does GraalVM perform on a beefy 200 MHz 32-bit microcontroller with 256 kB RAM? How do you use GraalVM to run existing C++ code on a website? Or does your definition of "generic" exclude some platforms? Don't get me wrong, I'm sure GraalVM has its uses in the server side, and perhaps in desktop (or even mobile) application context. It just doesn't seem generic in a way that is useful for embedding small/medium size libraries/executable code on top of systems written in C/C++/Rust.
- repolfx 8y agoWhy would I want to run AutoCad inside a web browser instead of just downloading it? Why do web browser developers feel that "run existing C++ code in a web page" is the most important thing facing the web? And for the microcontroller, likewise - why would I want the overhead of a WASM VM on such a device? You won't fit V8 on it. Anyway, Graal can AOT compile programs down to small native binaries, but they're not that small at this time: give it a few megabytes of RAM and then yes it's possible.
- 8y ago