Records do not cache their hash codes like normal Clojure maps, which affects their performance. This problem has been fixed in CLJS, but still affects JVM CLJ.
Approach: Cache hash values in record definitions, similar to maps.
Screened by: Alex Miller
Moving back to vetted for screening
Hey Nicola, two comments on the hasheq/hashcode impl:
1) I don't think there's any reason to use == in the check instead of =, and = seems better (I think the resulting bytecode is same either way though).
2) The generated bytecode in these cases will call getfield twice in the cached case (once for the check, and once for the return):
Letting a local will avoid that:
For me, this was about 2% faster in bench too.
Equivalent change in hashCode too.
Updated patch takes into account Alex's last notes
Added clj-1224-3.patch - identical to prior but uses zero? rather than = 0 at Rich's request. Attribution retained.