Fork me on GitHub
#clojure-dev
<
2019-08-25
>
ghadi03:08:27

https://bugs.openjdk.java.net/browse/JDK-8223051 @andy.fingerhut HotSpot doesn't currently perform useful optimizations on loops with a long trip count

jumar04:08:40

That's a good point but I don't see how this explains the observed performance difference. Isn't the loop variable long in both cases (as Andy observed)?

andy.fingerhut04:08:41

Yeah, I do not think that fact fully explains what is going on. I have hacked Clojure to allow an int primitive loop variable, and JIT can compile it to even slower code than the first iteration faster version with a long (but still faster than the 2nd and later iterations)