Re: hashmap keys

2017-11-12 Thread Jay Porcasi
that was extremely instructive thank you very much! On Sunday, November 12, 2017 at 3:33:31 PM UTC+7, Gary Verhaegen wrote: > > Retrieving a value from a hashmap goes through the following steps: > > 1) Compute the hashcode of the supplied key. > 2) Navigate through the map's internal tree

Re: hashmap keys

2017-11-12 Thread Gary Verhaegen
Retrieving a value from a hashmap goes through the following steps: 1) Compute the hashcode of the supplied key. 2) Navigate through the map's internal tree structure to the bucket that should contain this hashcode (the complexity of this step depends on the number of different hashcodes stored

Re: hashmap keys

2017-11-11 Thread Jay Porcasi
thank you very much for the clarification so no magic there :-) using big nested structures as keys is gonna slow down things a bit but how caching can help? On Friday, November 10, 2017 at 12:29:41 PM UTC+7, tbc++ wrote: > > Most Clojure collections cache their hashcode, so that improves things

Re: hashmap keys

2017-11-09 Thread Timothy Baldridge
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

hashmap keys

2017-11-09 Thread Jay Porcasi
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