Descriptionruntime: allocate maps' first bucket table lazily
Motivated by garbage profiling in HTTP benchmarks. This
changes means new empty maps are just one small allocation
(the HMap) instead the HMap + the relatively larger h->buckets
allocation. This helps maps which remain empty throughout
their life.
benchmark old ns/op new ns/op delta
BenchmarkNewEmptyMap 196 107 -45.41%
benchmark old allocs new allocs delta
BenchmarkNewEmptyMap 2 1 -50.00%
benchmark old bytes new bytes delta
BenchmarkNewEmptyMap 195 50 -74.36%
Patch Set 1 #Patch Set 2 : diff -r 05653fa6bcc4 https://go.googlecode.com/hg/ #Patch Set 3 : diff -r 05653fa6bcc4 https://go.googlecode.com/hg/ #Patch Set 4 : diff -r 3d477c8de1c2 https://go.googlecode.com/hg/ #
MessagesTotal messages: 10
|