Skip to content

Commit fef0dc0

Browse files
committed
Use efficient map delete pattern intead of allocating new map
1 parent e471a5a commit fef0dc0

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

internal/async/map_migratedfynedo.go

+3-1
Original file line numberDiff line numberDiff line change
@@ -69,5 +69,7 @@ func (m *Map[K, V]) Store(key K, value V) {
6969

7070
// Clear removes all entries from the map.
7171
func (m *Map[K, V]) Clear() {
72-
m.m = make(map[any]V)
72+
for k := range m.m {
73+
delete(m.m, k)
74+
}
7375
}

0 commit comments

Comments
 (0)