1
0
mirror of https://github.com/golang/go synced 2024-11-18 15:54:42 -07:00
go/test
Dmitry Vyukov b3be360f16 cmd/gc: allocate non-escaping maps on stack
Extend escape analysis to make(map[k]v).
If it does not escape, allocate temp buffer for hmap and one bucket on stack.

There are 75 cases of non-escaping maps in std lib.

benchmark                                    old allocs     new allocs     delta
BenchmarkConcurrentStmtQuery                 16161          15161          -6.19%
BenchmarkConcurrentTxQuery                   17658          16658          -5.66%
BenchmarkConcurrentTxStmtQuery               16157          15156          -6.20%
BenchmarkConcurrentRandom                    13637          13114          -3.84%
BenchmarkManyConcurrentQueries               22             20             -9.09%
BenchmarkDecodeComplex128Slice               250            188            -24.80%
BenchmarkDecodeFloat64Slice                  250            188            -24.80%
BenchmarkDecodeInt32Slice                    250            188            -24.80%
BenchmarkDecodeStringSlice                   2250           2188           -2.76%
BenchmarkNewEmptyMap                         1              0              -100.00%
BenchmarkNewSmallMap                         2              0              -100.00%

benchmark                old ns/op     new ns/op     delta
BenchmarkNewEmptyMap     124           55.7          -55.08%
BenchmarkNewSmallMap     317           148           -53.31%

benchmark                old allocs     new allocs     delta
BenchmarkNewEmptyMap     1              0              -100.00%
BenchmarkNewSmallMap     2              0              -100.00%

benchmark                old bytes     new bytes     delta
BenchmarkNewEmptyMap     48            0             -100.00%
BenchmarkNewSmallMap     192           0             -100.00%

Fixes #5449

Change-Id: I24fa66f949d2f138885d9e66a0d160240dc9e8fa
Reviewed-on: https://go-review.googlesource.com/3508
Reviewed-by: Keith Randall <khr@golang.org>
Run-TryBot: Dmitry Vyukov <dvyukov@google.com>
2015-02-12 09:53:52 +00:00
..
bench build: adjustments for move from src/pkg to src 2014-09-08 00:06:45 -04:00
bugs test: migrate remaining tests to run.go 2014-12-22 22:41:34 +00:00
chan cmd/gc: implement 'for range x {' 2014-07-16 19:27:10 -04:00
ddd2.dir
dwarf
fixedbugs cmd/gc: eliminate dead code in switch statements 2015-02-06 19:05:47 +00:00
import2.dir
import4.dir
interface cmd/gc: blank methods are not permitted in interface types 2014-10-15 09:55:13 -07:00
ken
method4.dir
safe
stress build: adjustments for move from src/pkg to src 2014-09-08 00:06:45 -04:00
syntax
64bit.go
235.go
alias1.go
alias.go
append.go
args.go
assign1.go
assign.go cmd/gc: prohibit short variable declarations containing duplicate symbols 2014-10-06 17:16:39 -04:00
bigalg.go
bigmap.go
blank1.go
blank.go
bom.go
bombad.go
bounds.go
chancap.go
chanlinear.go runtime: test for linear enqueue/dequeue behavior 2014-12-08 22:18:17 +00:00
char_lit1.go
char_lit.go
clearfat.go [dev.power64] 9g: fix under-zeroing in clearfat 2014-10-31 11:08:27 -04:00
closedchan.go
closure1.go cmd/gc: capture variables by value 2015-01-29 13:07:30 +00:00
closure2.go cmd/gc: fix capturing by value for range statements 2015-02-03 15:48:48 +00:00
closure.go
cmp6.go
cmp.go
cmplx.go
cmplxdivide1.go
cmplxdivide.c test: comment the behavior and use of cmplxdivide* 2015-01-15 00:00:06 +00:00
cmplxdivide.go test: comment the behavior and use of cmplxdivide* 2015-01-15 00:00:06 +00:00
complit1.go
complit.go
compos.go
const1.go
const2.go
const3.go
const4.go
const5.go cmd/gc: reject builtin function calls in len(fixed array) constants 2014-04-03 19:04:33 -04:00
const6.go
const.go
convert1.go
convert3.go
convert.go
convlit1.go
convlit.go
convT2X.go
copy.go
crlf.go
ddd1.go
ddd2.go
ddd.go
decl.go
declbad.go
defer.go
deferfin.go
deferprint.go
deferprint.out
divide.go
divmod.go
empty.go
env.go
eof1.go
eof.go
errchk
escape2.go cmd/gc: allocate non-escaping maps on stack 2015-02-12 09:53:52 +00:00
escape2n.go cmd/gc: allocate non-escaping maps on stack 2015-02-12 09:53:52 +00:00
escape3.go
escape4.go
escape5.go
escape.go
fibo.go Fix whitespace (use blanks consistently). 2014-12-08 22:22:58 +00:00
float_lit2.go test: fix two typos in float_lit2.go 2014-05-21 17:19:12 -04:00
float_lit3.go test/float_lit2.go: rewrite to test values near boundaries 2014-05-21 17:12:06 -04:00
float_lit.go
floatcmp.go
for.go
func1.go
func2.go
func3.go
func4.go
func5.go
func6.go
func7.go
func8.go
func.go
funcdup2.go
funcdup.go
gc1.go
gc2.go test: check for build constraints only upto the first blank line 2015-02-06 05:36:26 +00:00
gc.go
gcstring.go
goprint.go
goprint.out
goto.go
helloworld.go
helloworld.out
if.go
import1.go
import2.go
import4.go
import5.go
import.go
index0.go
index1.go
index2.go
index.go
indirect1.go
indirect.go
init1.go runtime: increase GC concurrency. 2015-01-08 20:34:56 +00:00
init.go
initcomma.go
initialize.go
initializerr.go
int_lit.go
intcvt.go
iota.go
label1.go
label.go
linkx_run.go cmd/go: put user ldflags at the end of the linker invocation 2015-01-02 18:36:44 +00:00
linkx.go test: move linkx and sinit to run.go 2014-11-06 15:14:08 -05:00
literal.go
live1.go
live2.go cmd/gc: allocate non-escaping maps on stack 2015-02-12 09:53:52 +00:00
live.go cmd/gc: allocate non-escaping maps on stack 2015-02-12 09:53:52 +00:00
mallocfin.go
map1.go
map.go test/mapnan.go: add regression test for non-empty interfaces. 2014-08-06 17:02:55 -04:00
maplinear.go test: make maplinear more robust 2014-10-27 18:59:02 -04:00
method1.go
method2.go
method3.go
method4.go
method5.go
method.go
named1.go cmd/gc: comma-ok assignments produce untyped bool as 2nd result 2014-08-11 16:11:55 -07:00
named.go
nil.go
nilcheck.go cmd/gc: optimize existence-only map lookups 2015-01-07 22:36:06 +00:00
nilptr2.go
nilptr3.go all: power64 is now ppc64 2014-12-05 19:13:20 -05:00
nilptr4.go
nilptr.go
nosplit.go test: check for build constraints only upto the first blank line 2015-02-06 05:36:26 +00:00
nul1.go
parentype.go
peano.go
print.go runtime: move built-in print routines to go. 2014-07-31 13:48:48 -07:00
print.out runtime: move built-in print routines to go. 2014-07-31 13:48:48 -07:00
printbig.go
printbig.out
range.go cmd/gc: implement 'for range x {' 2014-07-16 19:27:10 -04:00
recover1.go
recover2.go
recover3.go
recover.go test: add more cases to recover.go 2014-10-22 08:06:15 -07:00
rename1.go
rename.go
reorder2.go cmd/gc: shorten temporary lifetimes when possible 2014-04-01 13:31:38 -04:00
reorder.go
return.go
rotate0.go
rotate1.go
rotate2.go
rotate3.go
rotate.go
run.go test: check for build constraints only upto the first blank line 2015-02-06 05:36:26 +00:00
rune.go
runtime.go
shift1.go test: avoid "declared but not used" errors in shift1.go 2014-07-20 12:25:24 -07:00
shift2.go
sieve.go
sigchld.go
sigchld.out
simassign.go
sinit_run.go test: fix nacl build 2014-11-09 21:10:49 -05:00
sinit.go test: move linkx and sinit to run.go 2014-11-06 15:14:08 -05:00
sizeof.go
slice3.go cmd/gc, runtime: treat slices and strings like pointers in garbage collection 2014-08-25 14:38:19 -04:00
slice3err.go
slicecap.go cmd/gc, runtime: treat slices and strings like pointers in garbage collection 2014-08-25 14:38:19 -04:00
solitaire.go
stack.go
string_lit.go
stringrange.go
struct0.go
switch3.go
switch4.go
switch.go
tinyfin.go
torture.go cmd/8g: don't allocate a register early for cap(CHAN). 2014-07-01 09:20:51 +02:00
turing.go
typecheck.go
typeswitch1.go
typeswitch2.go
typeswitch3.go
typeswitch.go
undef.go
utf.go
varerr.go
varinit.go
zerodivide.go