|
|
|
|
|
by cbp
4582 days ago
|
|
Since you know the division in collatz-next is always exact you can change / for quot or a bit-shift-right. That should improve it somewhat. You should also typehint with ^long the arguments to your functions. Further than that I would probably compile the code and then use a decompiler to check for boxing. But I can't say I've done much math intensive programming in clojure. |
|
4.5 -> 2.7 seconds on my machine when using 'quot' instead of '/'.
2.4 seconds when hinting ^long in argument of collatz-length.
1.6 when also hinting ^long in collatz-next. Interestingly, when I hint only in collatz-next it takes 1.5.