Christophe Grand <
chris...@cgrand.net> writes:
Hi Christophe,
> Currently associative destructuring always expands to calls to get
> even when the key is a keyword. I have a small patch which make it
> expands to direct keyword lookups.
What's the benefit of that? At least a quick benchmark seems to
indicate that the performance is equal.
--8<---------------cut here---------------start------------->8---
user=> (use 'criterium.core)
nil
user=> (let [m {:a 1, :b 2, :c 3, :d 4, :e 5, :f 6, :g 7, :h 8}]
(bench (get m :g))
(bench (:g m)))
Evaluation count : 173624160 in 60 samples of 2893736 calls.
Execution time mean : 353.140625 ns
Execution time std-deviation : 26.118695 ns
Execution time lower quantile : 339.868576 ns ( 2.5%)
Execution time upper quantile : 374.317787 ns (97.5%)
Found 4 outliers in 60 samples (6.6667 %)
low-severe 2 (3.3333 %)
low-mild 2 (3.3333 %)
Variance from outliers : 55.1380 % Variance is severely inflated by outliers
Evaluation count : 166152240 in 60 samples of 2769204 calls.
Execution time mean : 368.768440 ns
Execution time std-deviation : 14.631760 ns
Execution time lower quantile : 357.451880 ns ( 2.5%)
Execution time upper quantile : 398.427724 ns (97.5%)
Found 2 outliers in 60 samples (3.3333 %)
low-severe 2 (3.3333 %)
Variance from outliers : 25.4904 % Variance is moderately inflated by outliers
nil
--8<---------------cut here---------------end--------------->8---
Bye,
Tassilo