From a bit of debug printing and experiments, it does appear that unlike let
, loop
replaces the type of primitive int
with long
, and of float
with double
: https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/Compiler.java#L6385-L6397
Again, I still do not know whether that is causing this performance oddity, but it is different than what the docs say here: https://clojure.org/reference/java_interop#primitives