hi all, I’m profiling some code in a tight loop, it seems that I’m creating alot of maps. Any advice on perf optimizations? I thought about either using records or volatile-mutable
have you tried transients?
that was my idea too => see https://clojure.org/reference/transients
or perhaps you can get rid of excessive objects creation by changing your algorithm / using different data structures.
Tried transients, it gives a small improv but the very best is volatible mutable
records dont give alot of improvement
@mping Have you also confirmed there is no reflection or boxing/unboxing?
@seancorfield yep, that fixed it quite a bit
we use destructuring alot , so we end up passing maps around to supply fn arguments
according to my completely unscientific benchmark, defrecord is just a bit better than plain maps
records wouldn't actually help here - they are just maps with more methods on them
also destructuring is more expensive than just using maps, I'd never destructure in a tight loop
i thought records did provide better performance than a plain map
oh, for the defined fields, yes, thanks for the reminder