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%
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.
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
Unfortunately that’s not that @seancorfield
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
I think it’s something with the way I built the loop
Are you traversing a sequence or incrementing numbers?
Mostly copied from https://github.com/metosin/jsonista/blob/master/src/java/jsonista/jackson/PersistentHashMapDeserializer.java
Also for some reason using transient
, assoc!
, and persisten!
for some reason degraded the performance as well 😢
I think you can swap not=
with (not (identical? ,,,))
you'll get some speed back