On Dec 28, 10:28 pm, Mark Engelberg <mark.engelb...@gmail.com> wrote:
> On Tue, Dec 28, 2010 at 10:15 PM, David Nolen <dnolen.li...@gmail.com> wrote:
> > Even in in a single threaded context raw insert performance isn't the final
> > word. What if you want to be able to deliver a snapshot for reporting?
>
> What if you don't?

Use transients?

(dotimes [_ 10]
  (let [m (atom (transient {}))
        r (range 1e5)]
   (time
    (doseq [i r]
      (swap! m assoc! i 2)))))

is within 50% the speed of an ordinary java.util.HashMap, by my
measurements.  And if you want snapshots at every step, in the worst
case you pay the price you've measured above.

-Jason

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