]> Cypherpunks repositories - gostls13.git/commit
cmd/compile: avoid stack allocation of a map bucket for large constant hints
authorMartin Möhrmann <moehrmann@google.com>
Wed, 30 Aug 2017 23:00:39 +0000 (01:00 +0200)
committerMartin Möhrmann <moehrmann@google.com>
Wed, 6 Sep 2017 04:38:12 +0000 (04:38 +0000)
commit6c102e141c5858d1b900afad8dd616370f6091bb
treea8010c5dded566f8259683843b2b51dd16069b5c
parent034d825ea304a87e4df4f3edad7d3cfcbfc9c526
cmd/compile: avoid stack allocation of a map bucket for large constant hints

runtime.makemap will allocate map buckets on the heap for hints larger
than the number of elements a single map bucket can hold.

Do not allocate any map bucket on the stack if it is known at compile time
that hint is larger than the number of elements one map bucket can hold.
This avoids zeroing and reserving memory on the stack that will not be used.

Change-Id: I1a5ab853fb16f6a18d67674a77701bf0cf29b550
Reviewed-on: https://go-review.googlesource.com/60450
Run-TryBot: Martin Möhrmann <moehrmann@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
src/cmd/compile/internal/gc/walk.go
src/runtime/map_test.go