3 ms·
Yup, once hotspot kicks in on the JVM, a toy language is going to have a hard time competing with that performance. It’s definitely disingenuous to include JVM
by tmountain 4y ago
Yup, once hotspot kicks in on the JVM, a toy language is going to have a hard time competing with that performance. It’s definitely disingenuous to include JVM start up time in any benchmark. I used to run clojure benchmarks in a REPL and I would watch as the functions I was testing dramatically increased in performance over a few invocations. JIT compilation is pretty incredible.
- dunefox 4y ago> It’s definitely disingenuous to include JVM start up time in any benchmark. It's not since startup time matters for CLI applications.
- pjmlp 4y agoEasy, use JIT caches.
- DeathArrow 4y ago>JIT compilation is pretty incredible. Not if you compare to AOT for languages who lack garbage collectors. C, C++, Fortran would still be quite faster.
- pjmlp 4y agoJIT cache is the answer, or one of the AOT compilers that exist for ages.
- kaba0 4y agoGiven sufficient time and a sufficiently expert programmer. It is not that easy to beat Java for complex programs where your workload is really variable and can’t use the usual tools like arenas.
- tsimionescu 4y agoThere are some workloads where Java's JIT can beat C, C++, Fortran AOT compilation. They are probably not very common, but stuff like un-inlining can really save on instruction cache misses in workloads where the most likely path is consistent for fixed periods of time, but changes relatively often (for something like `if COND { foo(); } else { bar(); }` in a hot loop, where COND is sometimes true for a while than false for another while). Of course, Java also has a lot of overhead from the language and implementation level, because of things like no generic lists of integers, no struct embedding leading to lots of pointer-chasing, a tendency for over-allocation, and direct overhead of the advanced JIT itself - performance counters, dummy instructions to support de/re-optimizations on the fly etc.