On Apr 7, 7:56 am, David Nolen <dnolen.li...@gmail.com> wrote:
> The runtime cost of destructuring is not worth getting worked up
> about. It's easy to check this yourself with (time ...)

Results below:

user=> (defn fk [& {:keys [a b c]}] (+ a b c))

user=> (defn fp [a b c] (+ a b c))

user=> (time (dotimes [_ 1000000] (fk :a 2 :b 2 :c 2)))
"Elapsed time: 1582.178 msecs"

user=> (time (dotimes [_ 1000000] (fp 2 2 2)))
"Elapsed time: 319.243 msecs"

Not sure how significant that would be in user code, but I'd rather
not have to choose less a less readable version because of the hit.
Positional keywords would give the readable function calls without the
run-time hit (and we could still use optional &keys if they were
somehow distinguished in the function calls).

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Reply via email to