Skip to content

Commit 44dafcb

Browse files
authored
Merge pull request #98 from orcaman/calc_key_length_once
Calc key length once
2 parents 16402b4 + 8c771cd commit 44dafcb

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

concurrent_map.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -312,7 +312,8 @@ func (m ConcurrentMap) MarshalJSON() ([]byte, error) {
312312
func fnv32(key string) uint32 {
313313
hash := uint32(2166136261)
314314
const prime32 = uint32(16777619)
315-
for i := 0; i < len(key); i++ {
315+
keyLength := len(key)
316+
for i := 0; i < keyLength; i++ {
316317
hash *= prime32
317318
hash ^= uint32(key[i])
318319
}

0 commit comments

Comments
 (0)