Our use of ps.Map implies many heap allocations #2866
Labels
chore
Related to fix/refinement/improvement of end user or new/existing developer functionality
performance
Excessive resource usage and latency; usually a bug or chore
Take
StringLatestMap
which is likemap[string]*struct{time.Time,string}
Each node in the map is an allocation of a
ps.tree struct
(size 112 bytes).Each key and value string is an allocation, and the value struct is an allocation because it's boxed to be held as an
interface{}
by theps.tree struct
So a map with
n
entries requires4n
memory allocations.Relates to #1010
I have started a reimplementation of
StringLatestMap
based on a slice, which is a similar idea to #1758.The text was updated successfully, but these errors were encountered: