alphadose / haxmap

Fastest and most memory efficient golang concurrent hashmap
MIT License
915 stars 45 forks source link

Unnecessary resizing #35

Closed semihbkgr closed 1 year ago

semihbkgr commented 1 year ago

Map is resizing unnecessarily after same operations although the map length is always same.

m := New[int, any]()
fmt.Printf("len: %d, indexCount: %d\n", m.Len(), len(m.metadata.Load().index))
for i := 0; i < 10000; i++ {
    m.Set(i, nil)
    m.Del(i)
}
fmt.Printf("len: %d, indexCount: %d\n", m.Len(), len(m.metadata.Load().index))

the output:

len: 0, indexCount: 8
len: 0, indexCount: 16384