3 ms·
> As you can see, the main benefits aren't tied to performance, but to portability, safety and flexibility. I think the usual focus on performance is a red herr
by kannanvijayan 8y ago
> As you can see, the main benefits aren't tied to performance, but to portability, safety and flexibility. I think the usual focus on performance is a red herring.
I'd recharacterize the performance question - the question as I've observed it has been "can we get all of these nice things without sacrificing too much performance", where the bar for "too much" has continually moved.
From the 100x slower days of early TCL implementations, to 10x, now down to some small percentage overhead.
It's good that the bar keeps moving - it puts pressure on the JIT world to keep delivering. I don't have the time to write up a long post about my personal thoughts on the long-term future of JITs, but I can summarize it thus (I realize it's a bit of polemic perspective):
1. I believe JIT compilation will slowly become the norm for most program execution environments - even for static languages. Wasm is a kick in that direction, and more will follow.
2. One reason I'm excited about JITs slowly making their way into static languages is things like proper first-class, _highly performant_ implementations of higher-order parametric polymorphism. For a quick example, I am always slightly annoyed when Rust tells me that I can't take a reference to a trait because it's not an Object trait:
```
trait Foo {
fn bar<A>(...);
}
let foo: &Foo = ...; // Invalid. Foo is not an object trait.
```
The reason we don't get to have this very nice, wonderful, powerful thing is because we need to specialize ALL occurrences of `bar`. I want this feature in my life. I've butted my head too many times against it and had to implement a compromised solution with type erasure and re-discovery on the other end of an API, leading to lots of unnecessary complexity, code duplication, and surface area for bugs.
A VM carrying a JIT that knows how to compile new specializations on demand effectively renders the notion of `object traits` obsolete.
Now Rust is not the right language for that (it wants to be bare metal and runtime-free and low-level). However, I would love for higher-level statically typed languages to start offering me these capabilities.
3. I actually believe performance with JITs will eventually be better than pre-compiled code. Our techniques are still young and somewhat ad-hoc. There are concrete areas where there is significant room for improvement in the design and implementation of JIT engines. This industry is still basically in its infancy.
- pjmlp 8y agoYou should spend some time reading about mainframe execution environments for z/OS and IBM i. JIT has been the norm since they exist, code is compiled to bytecode and AOT compiled at installation time or on demand if the environment is changed in some way. In a way, similar to deployment scenarios adopted by Android, Windows Store and to a smaller extent Apple devices.