Most Clojure collections cache their hashcode, so that improves things
quite bit. Also, very large collections are rarely used as *keys* in other
maps. Most of the time key collections are one or two values. This means
that what we're really talking about is combining the hash values of a few
values, and that's pretty fast.

So sure, the initial hash of one million symbols inside a vector may take a
fair amount of time, but I've never seen that in the wild.

Timothy

On Thu, Nov 9, 2017 at 10:08 PM, Jay Porcasi <jaygporc...@gmail.com> wrote:

> i would love to know in a bit more detail how Clojure manages to allow
> arbitrary data structures as keys for its immutable hashmaps
> hashing an atomic value as a string or number is fast and i see how that
> would work when atomic values are used as keys
> but how about using a big nested vector as a key? wouldn't hashing it take
> an unacceptable amount of time?
> yet Clojure manages to do just that and i wonder how
> thank you for any bit of clarification
> Jay
>
> --
> 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
> ---
> You received this message because you are subscribed to the Google Groups
> "Clojure" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to clojure+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>



-- 
“One of the main causes of the fall of the Roman Empire was that–lacking
zero–they had no way to indicate successful termination of their C
programs.”
(Robert Firth)

-- 
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
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to