Hi, your comparison is not fair. The map example merely assoc's a new value, while in the record case you create a complete fresh value with a different type. Here some more comparisons:
user=> (defrecord Foo [a b]) user.Foo user=> (defrecord Bar [a b c]) user.Bar user=> (let [x (->Foo 10 20)] (time (assoc (map->Bar x) :c 30))) "Elapsed time: 0.130464 msecs" #user.Bar{:a 10, :b 20, :c 30} user=> (let [x (->Foo 10 20)] (time (->Bar (:a x) (:b x) 30))) "Elapsed time: 0.288585 msecs" #user.Bar{:a 10, :b 20, :c 30} user=> (let [x {:a 10 :b 20}] (time (assoc (into {} x) :c 30))) "Elapsed time: 2.231289 msecs" {:c 30, :a 10, :b 20} user=> (let [x (->Bar 10 20 0)] (time (assoc x :c 30))) "Elapsed time: 0.011454 msecs" #user.Bar{:a 10, :b 20, :c 30} user=> (let [x {:a 10 :b 20}] (time (assoc x :c 30))) "Elapsed time: 0.042743 msecs" {:c 30, :a 10, :b 20} To get more realistic numbers I strongly suggest to use criterium<https://github.com/hugoduncan/criterium>for benchmarking, which coincidentally just released a new version. Kind regards, Meikel -- 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