Clojure

Records do not cache hash like normal maps

Details

  • Type: Enhancement Enhancement
  • Status: Open Open
  • Priority: Major Major
  • Resolution: Unresolved
  • Affects Version/s: None
  • Fix Version/s: None
  • Component/s: None
  • Patch:
    Code
  • Approval:
    Triaged

Description

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.

Patch: 0001-CLJ-1224-cache-hasheq-and-hashCode-for-records.patch

Also see: http://dev.clojure.org/jira/browse/CLJS-281

Activity

Nicola Mometto made changes -
Field Original Value New Value
Attachment 0001-CLJ-1224-cache-hasheq-and-hashCode-for-records.patch [ 12041 ]
Brandon Bloom made changes -
Labels patch patch,
Andy Fingerhut made changes -
Patch Code [ 10001 ]
Alex Miller made changes -
Labels patch patch,
Alex Miller made changes -
Approval Triaged [ 10120 ]
Alex Miller made changes -
Priority Minor [ 4 ] Critical [ 2 ]
Alex Miller made changes -
Labels defrecord performance
Alex Miller made changes -
Description This came up with dnolen and ambrose in irc. Apparently it was also an issue for Mark Engleberg with Instaparse. This has been fixed in CLJS, but still affects JVM CLJ.

See http://dev.clojure.org/jira/browse/CLJS-281
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.

*Patch:* 0001-CLJ-1224-cache-hasheq-and-hashCode-for-records.patch

*Also see:* http://dev.clojure.org/jira/browse/CLJS-281
Issue Type Defect [ 1 ] Enhancement [ 4 ]
Alex Miller made changes -
Priority Critical [ 2 ] Major [ 3 ]
Hide
Nicola Mometto added a comment -

I want to point out that my patch breaks ABI compatibility.
A possible approach to avoid this would be to have 3 constructors instead of 2, I can write the patch to support this if desired.

Show
Nicola Mometto added a comment - I want to point out that my patch breaks ABI compatibility. A possible approach to avoid this would be to have 3 constructors instead of 2, I can write the patch to support this if desired.

People

Vote (7)
Watch (6)

Dates

  • Created:
    Updated: