Hi, all.

I am following an example demonstrating that `transient` can help optimize 
mass updates to data structures:

First, a function is defined, which doesn't use transient collection:

(defn naive-into
>   [coll source]
>   (reduce conj coll source))


This is supposed to run slower than the built-in `into`, because, as the 
book said, `into` uses transient collections whenever possible.

But the result shows up in my `repl` is just the reverse.


> user=> (time (do (into #{} (range 1e6)) nil))
> "Elapsed time: 4882.176 msecs"
> nil
> user=> (time (do (naive-into #{} (range 1e6)) nil))
> "Elapsed time: 3745.707 msecs"
> nil


What could be the reason of this?

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