4 ms·
Alon Zakai[1] gave a good talk[2] on the current state of WebAssembly, particularly on the current state of performance 1. https://twitter.com/kripken https://
by harikb 6y ago
Alon Zakai[1] gave a good talk[2] on the current state of WebAssembly, particularly on the current state of performance
1. https://twitter.com/kripken https://twitter.com/kripken
2. https://youtu.be/4ZMY3QE5t9o https://youtu.be/4ZMY3QE5t9o
- apatheticonion 6y agoI'm not certain exactly how LLVM works so I am not sure this is the right question to ask but - How does Web Assembly relate/compare to LLVM? Does LLVM solve the problem of a single binary that can be run portably?
- harikb 6y agoThere are not comparable afaik. WASM is also more ambitious, along with WASI (system interface) creating a portable final executable (compare to JVM), whereas LLVM is only a set of intermediate language and tools. When this transition period goes away, LLVM should hopefully compile to WASM binary as a target. The current path described in the video of WASM -> C -> clang -> llvm -> native-binary is a temporary workaround afaik.
- jfkebwjsbx 6y agoWASM isn't "more ambitious". It is a spec for portable bytecode, nothing more, nothing less. LLVM is one of the best toolchains for many languages. They are completely different things.
- harikb 6y agoYes, I agree. Wording wasn't right. What I meant was that it is trying to define a universal target with runtime system interface and such. The only reason I drew a comparison was that both are trying to bring standardization, but in different contexts.
- zenhack 6y agoThey're trying to solve different problems. LLVM is trying to take care of most of the language-independent bits of writing a compiler, while wasm is a format for delivering code to browsers, with an eye towards being a good target for languages like C and making use of the existing JIT compilers in modern browsers. LLVM as a toolchain provides backends for many target machines, so as a compiler author you can just emit LLVM IR and (mostly)automatically be able to compile for x86, arm, mips, etc... And they have a wasm backend too, so the technologies are complementary -- you can use LLVM to compile to wasm. LLVM will do a fair bit of optimization too. The intent with LLVM is not to provide a portable binary distribution format, but to allow different compiler frontends to all share the same compiler backend logic. By contrast, with WASM the assumption is that by the time it gets to the browser the ahead-of-time compiler has already done a fair bit of optimization, so what a wasm compiler has to do is much simpler. WASM is also designed for space efficiency, since the code will be shipped over the network, and safety -- LLVM has a C-like notion of undefined behavior (which the optimizer makes use of), but this would be wildly inappropriate for WASM due to security (and portability) concerns.