@@ -32,7 +32,6 @@ import (
3232 "unsafe"
3333
3434 "github.com/Workiva/go-datastructures/list"
35- "github.com/Workiva/go-datastructures/queue"
3635)
3736
3837const (
@@ -41,9 +40,6 @@ const (
4140
4241 // exp2 is 2^w, which is the hashcode space.
4342 exp2 = 32
44-
45- // hasherPoolSize is the number of hashers to buffer.
46- hasherPoolSize = 16
4743)
4844
4945// HashFactory returns a new Hash32 used to hash keys.
@@ -59,7 +55,6 @@ type Ctrie struct {
5955 root * iNode
6056 readOnly bool
6157 hashFactory HashFactory
62- hasherPool * queue.RingBuffer
6358}
6459
6560// generation demarcates Ctrie snapshots. We use a heap-allocated reference
@@ -280,14 +275,9 @@ func New(hashFactory HashFactory) *Ctrie {
280275}
281276
282277func newCtrie (root * iNode , hashFactory HashFactory , readOnly bool ) * Ctrie {
283- hasherPool := queue .NewRingBuffer (hasherPoolSize )
284- for i := 0 ; i < hasherPoolSize ; i ++ {
285- hasherPool .Put (hashFactory ())
286- }
287278 return & Ctrie {
288279 root : root ,
289280 hashFactory : hashFactory ,
290- hasherPool : hasherPool ,
291281 readOnly : readOnly ,
292282 }
293283}
@@ -451,13 +441,9 @@ func (c *Ctrie) remove(entry *Entry) (interface{}, bool) {
451441}
452442
453443func (c * Ctrie ) hash (k []byte ) uint32 {
454- hasher , _ := c .hasherPool .Get ()
455- h := hasher .(hash.Hash32 )
456- h .Write (k )
457- hash := h .Sum32 ()
458- h .Reset ()
459- c .hasherPool .Put (h )
460- return hash
444+ hasher := c .hashFactory ()
445+ hasher .Write (k )
446+ return hasher .Sum32 ()
461447}
462448
463449// iinsert attempts to insert the entry into the Ctrie. If false is returned,
0 commit comments