Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  • Change the hash of integers that fit within a long to the return value of longHashMunge (see Longs section of doc for more details)
  • Change the current multiplier of 31 used for vectors, sequences, and queues to a different constant such as -16405315271640531535 or 524287 (see Vectors section).  Also applies to Cons, LazySeq.
  • For sets, instead of adding together the hash value of the elements, add together the return value of a function xorShift32 called on the hash value of each element (see Sets section)
  • For maps and records, instead of adding together hash(key) ^ hash(val) for each hash,val pair, instead add together hash(key)^xorShift32(hash(val)) (see Maps section)
  • No change for any other types, e.g. strings, keywords, symbols, floats, doubles, BigInt's outside of long range, BigDecimal, etc.

...

    https://github.com/jafingerhut/chess-clojure

    http://dev.clojure.org/download/attachments/8192765/better-hashing-2013-1011-3018.diff

Here is a summary of results for some program elapsed times and how spread out the hash values are.  Below the table are a few details on how these measurements were made.

...