diff options
| author | Keith Randall <khr@golang.org> | 2013-12-02 13:05:04 -0800 |
|---|---|---|
| committer | Keith Randall <khr@golang.org> | 2013-12-02 13:05:04 -0800 |
| commit | 3278dc158e34779eb46cd1b5a73c1d0c18602184 (patch) | |
| tree | 08c1e7f3d31872ccd79e40e5d1a811af80a30677 /src/pkg/runtime/panic.c | |
| parent | de0fd9aceeeaccee8c1851c22eb8bc1b2ad913c7 (diff) | |
| download | go-3278dc158e34779eb46cd1b5a73c1d0c18602184.tar.xz | |
runtime: pass key/value to map accessors by reference, not by value.
This change is part of the plan to get rid of all vararg C calls
which are a pain for getting exact stack scanning.
We allocate a chunk of zero memory to return a pointer to when a
map access doesn't find the key. This is simpler than returning nil
and fixing things up in the caller. Linker magic allocates a single
zero memory area that is shared by all (non-reflect-generated) map
types.
Passing things by reference gets rid of some copies, so it speeds
up code with big keys/values.
benchmark old ns/op new ns/op delta
BenchmarkBigKeyMap 34 31 -8.48%
BenchmarkBigValMap 37 30 -18.62%
BenchmarkSmallKeyMap 26 23 -11.28%
R=golang-dev, dvyukov, khr, rsc
CC=golang-dev
https://golang.org/cl/14794043
Diffstat (limited to 'src/pkg/runtime/panic.c')
0 files changed, 0 insertions, 0 deletions
