3 ms·
> an offline compiler like Clang can spend considerably more time to generate better code, whereas WebAssembly compilers must be fast enough to run online > [s
by iTokio 7y ago
> an offline compiler like Clang can spend considerably more time to generate better code, whereas WebAssembly compilers must be fast enough to run online
> [security] checks are necessary for WebAssembly’s safety
> current JavaScript implementations reserve a few registers for their own use, which increases register pressure on WebAssembly
- 0815test 7y agoRuntime security checks are not necessary for WebAssembly to be safe. You could compile from a memory-safe source language to start with and add support in the WASM format for proof-carrying code. Then all that's needed in the WASM runtime is a static check of the added proof information, which could be very quick. Runtime checks could still be used to run WASM that doesn't carry proofs of safety, keeping the same performance cost. (Some occasional runtime checks would nonetheless be needed, since safety against e.g. excessive stack use could depend on what the program is doing at runtime; but they would be quite rare and come with very little overhead.)
- PudgePacket 7y ago> > an offline compiler like Clang can spend considerably more time to generate better code, whereas WebAssembly compilers must be fast enough to run online https://hacks.mozilla.org/2018/01/making-webassembly-even-faster-firefoxs-new-streaming-and-tiering-compiler/ https://hacks.mozilla.org/2018/01/making-webassembly-even-fa... > One of these speedups is streaming compilation, where the browser compiles the code while the code is still being downloaded. Up until now, this was just a potential future speedup. But with the release of Firefox 58 next week, it becomes a reality. > Firefox 58 also includes a new 2-tiered compiler. The new baseline compiler compiles code 10–15 times faster than the optimizing compiler. Seems to deal with the "whereas WebAssembly compilers must be fast enough to run online"
- azakai 7y agoStreaming and tiering do help, and I believe all browsers do that. Still, the article's point is valid that offline compilers can spend more time compiling, because even if you have a faster tier before you, running a slower compiler eats up battery and increases the time before the code runs at full speed.
- mikehollinger 7y ago> an offline compiler like Clang can spend considerably more time to generate better code, whereas WebAssembly compilers must be fast enough to run online This echoes the arguments for / against java. The compiler in this context mustn’t be “fast enough to be online” - it must be fast enough to keep up and able to smart enough to know what’s important. It also benefits from watching the actual program execution. Presuming you can “warm up” the application, it might just do fine. I vaguely think that a lot of people are considering the compilation as a one time deal. It could be a phased thing. Java’s a great example of that.