Final update for today The Java array version was about 38x times slower than the Clojure vector version, which I found surprising, so I tried if I could speed it up.
I split a few things up into helper functions so I could type hint them, and used Java interop instead of
aset, all to try and prevent it from having to box and unbox numbers, and from having to reflect on types.
This worked, now the Java array version is about 3x faster than the Clojure version, so about 100x faster than the Java version without type hints.
here’s the result
Conclusion: always measure before you try to speed things up. Just because you’re using more lower level operations doesn’t always mean it’s faster.