You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, each time a new element is set as value to the map, a new element object is allocated on the heap and the pointer of it then set as value to the map.
This causes a lot of allocations when setting new key-value pairs. This might be bypassed by using a sync.Pool to create and cache element objects so they can be re-used after a value was deleted from the map, which often happens when values are expired.
Currently, each time a new
element
is set as value to the map, a newelement
object is allocated on the heap and the pointer of it then set as value to the map.This causes a lot of allocations when setting new key-value pairs. This might be bypassed by using a
sync.Pool
to create and cache element objects so they can be re-used after a value was deleted from the map, which often happens when values are expired.See this post as "template" on how to implement and use
sync.Pool
:https://www.akshaydeo.com/blog/2017/12/23/How-did-I-improve-latency-by-700-percent-using-syncPool
The text was updated successfully, but these errors were encountered: