Fork me on GitHub
#java
<
2020-10-21
>
DG18:10:12

Do any of you guys know if there’s a great article about novice java interop mistakes Clojure devs do (or general things to look for)? Migrated some code from java to java interop but my performance went down by like 10%

seancorfield18:10:57

Add (set! *warn-on-reflection* true) to each Clojure file just after the ns form. Reflection is the most likely cause of your performance issues.

seancorfield18:10:43

If you get reflection warnings, you should be able to add type hints to the code at those points to get rid of the warning and speed your code up @davidginzbourg

DG18:10:10

Unfortunately that’s not that @seancorfield

Ben Sless18:10:16

Also, if you're doing some number crunching make sure to turn on boxed math warnings, the difference in performance can be two orders of magnitude

DG18:10:36

I think it’s something with the way I built the loop

Ben Sless18:10:34

Are you traversing a sequence or incrementing numbers?

DG18:10:43

Also for some reason using transient, assoc!, and persisten! for some reason degraded the performance as well 😢

Ben Sless18:10:09

I think you can swap not= with (not (identical? ,,,))

Ben Sless18:10:16

you'll get some speed back

🙌 3