#'zipmap constructs a map without transients, where transients could improve performance.
Alt 1: 0002-CLJ-1005-use-transient-map-in-zipmap.patch - straightforward impl that next's through ks and vs as seqs, uses transients to accumulate and outputs a persistent map.
Alt 2: CLJ-1005-zipmap-iterators.patch - leverage internal RT.iter() from transducer support for a lighter weight iteration, also using transients for accumulation.
Timings collected with criterium.core/bench and Java 14:
(zipmap xs xs) ;; large
(zipmap ys ys) ;; small
Proposed: 0002-CLJ-1005-use-transient-map-in-zipmap.patch, doesn't use internal apis and is approximately the same as far as performance improvement.
Screened by: Alex Miller
Thanks, Andy. It was straightforward to update – an automatic rebase. Here's the updated patch.
New patch using clojure.lang.RT/iter, criterium shows >30% more perf in the best case. Less alloc probably but I didn't measure. CLJ-1499 (better iterators) is related
4 years later, this zipmap implementation in the core namespace is still not using a transient map internally. Is there a reason why this was never applied?
Multiple approaches proposed here, no consensus approach determined yet. Needs some focus time to narrow that down, and hasn’t been a priority yet.
Applied for 1.10.2-rc1