assoc* performance

Hashmaps
Lists
Sequences
Vectors

assoc* version 5 performance improved across the board, closing the gap with clojure.core/get.

See the overall summary for benchmarking details. The benchmarks displayed in this document are defined here.

Hashmaps

While version 5 of assoc* is 4 to 17% slower than clojure.core/get when handling hashmaps, it substantially closed the performance gap from version 4.

(fn [n] (assoc (map-of-n-key-vals n) (dec n) :benchmark-sentinel))

Benchmark measurements for expression `(fn [n] (assoc (map-of-n-key-vals n) (dec n) :benchmark-sentinel))`, time versus 'n' arguments, comparing different versions.

(fn [n] (assoc* (map-of-n-key-vals n) (dec n) :benchmark-sentinel))

Benchmark measurements for expression `(fn [n] (assoc* (map-of-n-key-vals n) (dec n) :benchmark-sentinel))`, time versus 'n' arguments, comparing different versions.

Lists

Handling lists is indistinguishable between version 4 to version 5.

(fn [n] (assoc* (list-of-n-rand-ints n) (dec n) :benchmark-sentinel))

Benchmark measurements for expression `(fn [n] (assoc* (list-of-n-rand-ints n) (dec n) :benchmark-sentinel))`, time versus 'n' arguments, comparing different versions.

Sequences

Version 5 handles sequences 40% faster than version 4.

(fn [n] (assoc (seq-of-n-rand-ints n) (dec n) :benchmark-sentinel))

Benchmark measurements for expression `(fn [n] (assoc (seq-of-n-rand-ints n) (dec n) :benchmark-sentinel))`, time versus 'n' arguments, comparing different versions.

(fn [n] (assoc* (seq-of-n-rand-ints n) (dec n) :benchmark-sentinel))

Benchmark measurements for expression `(fn [n] (assoc* (seq-of-n-rand-ints n) (dec n) :benchmark-sentinel))`, time versus 'n' arguments, comparing different versions.

Vectors

Version 5 performance improved noticeably, but still lags clojure.core/assoc by a factor of two.

(fn [n] (assoc (vec-of-n-rand-ints n) (dec n) :benchmark-sentinel))

Benchmark measurements for expression `(fn [n] (assoc (vec-of-n-rand-ints n) (dec n) :benchmark-sentinel))`, time versus 'n' arguments, comparing different versions.

(fn [n] (assoc* (vec-of-n-rand-ints n) (dec n) :benchmark-sentinel))

Benchmark measurements for expression `(fn [n] (assoc* (vec-of-n-rand-ints n) (dec n) :benchmark-sentinel))`, time versus 'n' arguments, comparing different versions.