Liking cljdoc? Tell your friends :D

assoc* performance

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. Show details

(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. Show details

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. Show details

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. Show details

(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. Show details

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. Show details

(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. Show details

Can you improve this documentation?Edit on GitHub

cljdoc builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
Move to previous article
Move to next article
Ctrl+/Jump to the search field
× close