Comment by torginus
3 hours ago
Portability isn't worth as much as it was advertised. There are a grand total of 2 relevant CPU architectures for consumers, ARM64 and x86_64. Shipping 2 binaries is just running the compiler twice.
On the client side, there's just a verifier, and then the runtime basically consists of branching to the first instruction and having at it. Near-native performance and instant startup, you can't do better than that.
PNaCL was proto-WebAssembly and suffering from the same issues. They actually shipped LLVM bytecode, and you had to compile the executable locally with the whole toolchain, leading to quite bad startup performance and a lot of baggage.
Turns out there's no such thing as portable VM assembly. You still have to ship a full compiler (well, JIT) and compile the WASM IR.
Browser vendors have spent uncountable amount of engineering resources on making yet another compiler (actually multiple, since afaik Chrome uses a tiered JIT for WASM), that's neither as good as the big boys, and neither as fast as just running the dang binary.
If you make the web dependent on a CPU architecture, you're giving up on a fundamental design principle and also letting one company control it.
Linux distros are shipped as binaries yet you can still build them from source, and are certainly not controlled by one company, I don't see why that would be the case here.
Would you require every website to come with architecture-independent source code? What happens if it doesn't match the compiled binary? Or would the browser compile it every time?
1 reply →