1
0
mirror of https://github.com/golang/go synced 2024-11-05 17:26:11 -07:00
go/src
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
..
archive archive/tar: set Header.Mode in example 2015-01-26 01:54:06 +00:00
bufio
builtin
bytes bytes, strings: improve documentation for Count functions 2015-01-22 18:28:35 +00:00
cmd cmd/gc: allocate non-escaping maps on stack 2015-02-12 09:53:52 +00:00
compress all: don't refer to code.google.com/p/go{,-wiki}/ 2015-02-06 14:41:47 +00:00
container
crypto crypto/x509: allow matchHostnames to work with absolute domain names 2015-02-11 01:20:35 +00:00
database/sql database/sql: reduce lock contention in Stmt.connStmt 2015-01-24 09:56:25 +00:00
debug
encoding encoding/xml: add more EncodeToken tests. 2015-02-09 04:02:45 +00:00
errors
expvar expvar: fix build 2015-02-05 13:53:29 +00:00
flag
fmt cmd/gc: allocate buffers for non-escaped strings on stack 2015-01-28 20:12:38 +00:00
go net: re-implement Interfaces and InterfaceAddrs for IPNet, IPv6 on Windows 2015-02-10 00:44:05 +00:00
hash
html all: don't refer to code.google.com/p/go{,-wiki}/ 2015-02-06 14:41:47 +00:00
image image: fix obsolete reference in PalettedImage doc comment 2015-02-06 04:06:44 +00:00
index/suffixarray
internal/syscall net: re-implement Interfaces and InterfaceAddrs for IPNet, IPv6 on Windows 2015-02-10 00:44:05 +00:00
io
lib9 lib9: provide alterantive implementation of ldexp and frexp 2015-02-06 05:40:28 +00:00
libbio
liblink cmd/gc: factor newly-portable code into gc directory 2015-02-11 20:36:27 +00:00
log log: add SetOutput method on Logger 2015-01-30 16:00:10 +00:00
math math/big: completed Float.Uint64 2015-02-11 17:03:08 +00:00
mime
net net: disable WriteMsgUDP tests on nacl, windows (fix build) 2015-02-10 23:21:40 +00:00
os syscall: Readlink doesn't handle junction on windows 2015-02-12 02:03:25 +00:00
path all: don't refer to code.google.com/p/go{,-wiki}/ 2015-02-06 14:41:47 +00:00
reflect reflect: mark map access functions as go:noescape 2015-02-11 10:37:45 +00:00
regexp regexp: update URLs in tests 2015-01-26 01:54:28 +00:00
runtime cmd/gc: allocate non-escaping maps on stack 2015-02-12 09:53:52 +00:00
sort sort: fixed small typo in comments 2015-02-08 23:38:50 +00:00
strconv strconv: simplified logic resulting in faster float formatting 2015-02-11 17:45:19 +00:00
strings bytes, strings: improve documentation for Count functions 2015-01-22 18:28:35 +00:00
sync sync/atomic: darwin/arm support 2015-02-06 05:49:14 +00:00
syscall syscall: Readlink doesn't handle junction on windows 2015-02-12 02:03:25 +00:00
testing testing: pad benchmark names to align results 2015-02-07 21:52:25 +00:00
text
time Build fix for plan9 after 8bf13838eb. 2015-02-08 22:30:46 +00:00
unicode
unsafe unsafe: minor doc string improvements 2015-01-28 19:42:15 +00:00
all.bash
all.bat
all.rc
androidtest.bash build: androidtest.bash has to use copy for files to adb-sync. 2015-01-15 13:53:03 +00:00
clean.bash
clean.bat
clean.rc
make.bash cmd/go, make: remove ccflags 2015-02-04 16:15:00 +00:00
make.bat [dev.cc] build: do not pass GOHOSTOS and GOHOSTARCH to Go 1.4 build 2015-01-14 20:17:20 +00:00
Make.dist
make.rc cmd/go, make: remove ccflags 2015-02-04 16:15:00 +00:00
nacltest.bash cmd/dist: reactivate vfp detection on linux/arm 2015-02-10 00:17:06 +00:00
race.bash
race.bat build: fix race.bat flags 2015-02-07 01:54:43 +00:00
run.bash
run.bat
run.rc