On Thu, May 26, 2011 at 8:50 PM, Andreas Kostler
<andreas.koestler.le...@gmail.com> wrote:
> Thanks Ken,
> using this approach brings a ~1000 times speedup :)
>
> (def a (sparse-vec (range 100000) (range 100000)))
>
> (def b (time (assc-ken a 111111 0)))
> "Elapsed time: 0.249 msecs"
>
> (def b (time (assc a 111111 0)))
> "Elapsed time: 252.06 msecs"
>
> Very worthwhile and it's clearer as well.

You're welcome. Keep in mind that this is a best-case insert, right at
the end, for the algo I posted. Inserts at the beginning won't be very
much faster than before, and in the middle will be in the middle.

-- 
Protege: What is this seething mass of parentheses?!
Master: Your father's Lisp REPL. This is the language of a true
hacker. Not as clumsy or random as C++; a language for a more
civilized age.

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