How I sped up Go by 20% (or is Go really slower than Java?)
blog.kowalczyk.info
How I sped up Go by 20% (or is Go really slower than Java?)
1–2 of 2 posts
Re: How I sped up Go by 20% (or is Go really slower than Java?)
#2Oh boy. It pains me every time I hear this.
In a microbenchmark, JIT compilation increases the time to ramp up to peak performance. Once you're at peak performance, compilation time doesn't matter anymore. At that point, the JIT compiler's drawbacks are mitigated by two distinct advantages.
First, the JIT has information about run-time conditions that was unavailable to the static compiler. It's hard to over-state how important it is to know, for example, which if-statements are highly biased, or which polymorphic calls are effectively monomorphic at run time.
Second, the JIT can make over-aggressive optimizations based on unverified assumptions, secure in the knowledge that when an assumption proves to be wrong, it can discard that code and re-compile another version of the same method, optimized according to the latest available information. This is only possible if the compiler is present at run-time.
[These are my personal opinions, not those of my employer.]