On 09/05/17 21:22, Steven R. Baker wrote:
I'd like to have that confirmed; it would challenge "conventional
wisdom" on static typing.
I don't recall details but I have read that no static type information
was actually used for "speeding up", it was all PICs etc. So yes, an
interesting fact.
However - I don't think you can "prove" anything in this area. The
fastest dynamic lang implementations like LuaJIT, V8 etc are still a
fair factor away from the performance of C, C++, Nim, Rust (and similar
statically typed langs and their compilers).
In other words, the things you can optimize dynamically in an advanced
runtime (say a tracing JIT like LuaJIT) haven't *yet* proven to overtake
the raw advantage of all possible compile time optimizations.
In theory a warmed up sufficiently advanced VM should beat statically
compiled code - simply by the fact it has more information at hand.
But... it hasn't been observed yet AFAIK. And even if it happens - in
many areas where you need raw power you also have:
- Memory requirements
- Consistency in speed
...and a VM like say the JVM tend to fail hard on both accounts even if
it can approach C++ speeds when sufficiently warmed up.
regards, Göran