by codeflo · 4y ago · 0 comments
What we get in return for all that pain is slightly faster execution — in theory. A recent post on HN actually showed that at least in some cases, modern LLVM compiles to code that actually runs 1-2% slower than an ancient LLVM version.
Shouldn’t we conclude from all this that what we need is a movement to go back to simple, deterministic and fast compilers?
Maybe the problem is that making big improvements to a compiler for a fifty year old language that sits pretty close to the metal is getting increasingly difficult because the people writing the compilers are running out of clever tricks.
Plenty of JavaScript and WASM exists for cryptography purposes, for what it's worth, because Node isn't the only runtime and "native" code isn't easily portable.
We also get protections against whole classes of security bugs, ala Spectre and other vulns. Some of those protections make speed tradeoffs.
(To explain: A decade ago, if there was a code path where you dereference null, you would get a clean crash. Not pretty, and potentially a denial of service, but usually not further exploitable. Nowadays, the compiler will infer that this path is not taken, eliminate the if, potentially eliminate other checks as well because they are then reasoned to be redundant, and then randomly execute something. This is practically more dangerous in a lot more situations than Spectre ever was.)