Thank everybody for the discussion. I am now aware of some pitfalls in 
using defrecord.

For me, I like to have type information associated with my data. I still 
prefer defrecord over map in general, but I will proceed with more caution. 
I think some pitfalls here are not due to the greatness of regular map, but 
is because record is not yet so great (e.x. Python has no problem 
serializing typed data). But still, with current state of things, those 
downsides are real.

By the way, it seems record is not necessarily slower than map in map 
operations. Here is my test result:

(defrecord myrec [a b])
(def rec (myrec. 1 2))
(def m {:a 1 :b 2})


user=> (time (dotimes [x 10000000] (assoc m :a 4)))
"Elapsed time: 2499.155478 msecs"

user=> (time (dotimes [x 10000000] (assoc rec :a 4)))
"Elapsed time: 802.191248 msecs"

But I did not test other operations.

-- 
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