Implement hash caching for primitive vectors

Description

1 2 3 4 5 6 7 8 9 10 11 (def v10k (vec (range 10000))) (def pv10k (apply vector-of :long (range 10000))) (def hm1 (hash-map v10k :v10k)) (def hm2 (hash-map pv10k :pv10k)) (time (frequencies (map (fn [i] (hm1 v10k)) (range 1000)))) ;; run time range [0.31, 0.77] msec (time (frequencies (map (fn [i] (hm2 pv10k)) (range 1000)))) ;; run time range [495, 567] msec

Profiling shows that almost all of the time in evaluating the last expression is in calculating the hash of value pv10k, which is because the hash calculation is not cached as it is for most other collections. There is a TBD in the implementation mentioning this.

Environment

None

Status

Assignee

Unassigned

Reporter

Andy Fingerhut

Labels

None

Approval

None

Patch

None

Affects versions

Release 1.10

Priority

Minor
Configure