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/runtime.h | |
| 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/runtime.h')
| -rw-r--r-- | src/pkg/runtime/runtime.h | 6 |
1 files changed, 0 insertions, 6 deletions
diff --git a/src/pkg/runtime/runtime.h b/src/pkg/runtime/runtime.h index f7c2adb121..129dc7d152 100644 --- a/src/pkg/runtime/runtime.h +++ b/src/pkg/runtime/runtime.h @@ -1037,12 +1037,6 @@ void runtime·osyield(void); void runtime·lockOSThread(void); void runtime·unlockOSThread(void); -void runtime·mapassign(MapType*, Hmap*, byte*, byte*); -void runtime·mapaccess(MapType*, Hmap*, byte*, byte*, bool*); -void runtime·mapiternext(struct hash_iter*); -bool runtime·mapiterkey(struct hash_iter*, void*); -Hmap* runtime·makemap_c(MapType*, int64); - Hchan* runtime·makechan_c(ChanType*, int64); void runtime·chansend(ChanType*, Hchan*, byte*, bool*, void*); void runtime·chanrecv(ChanType*, Hchan*, byte*, bool*, bool*); |
