java

DG 2020-10-21T18:09:12.002900Z

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%

seancorfield 2020-10-21T18:17:57.003800Z

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.

seancorfield 2020-10-21T18:18:43.004700Z

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

DG 2020-10-21T18:19:10.005100Z

Unfortunately that’s not that @seancorfield

Ben Sless 2020-10-21T18:19:16.005200Z

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

DG 2020-10-21T18:19:36.005600Z

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

Ben Sless 2020-10-21T18:20:34.005900Z

Are you traversing a sequence or incrementing numbers?

DG 2020-10-21T18:22:35.006400Z

DG 2020-10-21T18:24:43.007600Z

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

Ben Sless 2020-10-21T18:29:09.008100Z

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

Ben Sless 2020-10-21T18:29:16.008300Z

you'll get some speed back

🙌 1