]> Cypherpunks repositories - gostls13.git/commit
runtime: convert map implementation to Go.
authorKeith Randall <khr@golang.org>
Wed, 16 Jul 2014 21:16:19 +0000 (14:16 -0700)
committerKeith Randall <khr@golang.org>
Wed, 16 Jul 2014 21:16:19 +0000 (14:16 -0700)
commit0c6b55e76ba6d59f57c81ca1160d833c79270753
tree1a4739c1defbde987a0be14e9b6bc1c7cec07360
parent3b1b84069956bc8f21be37c563d0ba8da93a87d1
runtime: convert map implementation to Go.

It's a bit slower, but not painfully so.  There is still room for
improvement (saving space so we can use nosplit, and removing the
requirement for hash/eq stubs).

benchmark                              old ns/op     new ns/op     delta
BenchmarkMegMap                        23.5          24.2          +2.98%
BenchmarkMegOneMap                     14.9          15.7          +5.37%
BenchmarkMegEqMap                      71668         72234         +0.79%
BenchmarkMegEmptyMap                   4.05          4.93          +21.73%
BenchmarkSmallStrMap                   21.9          22.5          +2.74%
BenchmarkMapStringKeysEight_16         23.1          26.3          +13.85%
BenchmarkMapStringKeysEight_32         21.9          25.0          +14.16%
BenchmarkMapStringKeysEight_64         21.9          25.1          +14.61%
BenchmarkMapStringKeysEight_1M         21.9          25.0          +14.16%
BenchmarkIntMap                        21.8          12.5          -42.66%
BenchmarkRepeatedLookupStrMapKey32     39.3          30.2          -23.16%
BenchmarkRepeatedLookupStrMapKey1M     322353        322675        +0.10%
BenchmarkNewEmptyMap                   129           136           +5.43%
BenchmarkMapIter                       137           107           -21.90%
BenchmarkMapIterEmpty                  7.14          8.71          +21.99%
BenchmarkSameLengthMap                 5.24          6.82          +30.15%
BenchmarkBigKeyMap                     34.5          35.3          +2.32%
BenchmarkBigValMap                     36.1          36.1          +0.00%
BenchmarkSmallKeyMap                   26.9          26.7          -0.74%

LGTM=rsc
R=golang-codereviews, dave, dvyukov, rsc, gobot, khr
CC=golang-codereviews
https://golang.org/cl/99380043
29 files changed:
src/cmd/api/goapi.go
src/cmd/dist/buildruntime.c
src/cmd/ld/dwarf.c
src/pkg/reflect/asm_386.s
src/pkg/reflect/asm_amd64.s
src/pkg/reflect/asm_amd64p32.s
src/pkg/reflect/asm_arm.s
src/pkg/runtime/alg.goc
src/pkg/runtime/asm_386.s
src/pkg/runtime/asm_amd64.s
src/pkg/runtime/asm_amd64p32.s
src/pkg/runtime/asm_arm.s
src/pkg/runtime/defs.c
src/pkg/runtime/export_test.go
src/pkg/runtime/hashmap.go [new file with mode: 0644]
src/pkg/runtime/hashmap.goc [deleted file]
src/pkg/runtime/hashmap.h [deleted file]
src/pkg/runtime/hashmap_fast.c [deleted file]
src/pkg/runtime/hashmap_fast.go [new file with mode: 0644]
src/pkg/runtime/malloc.h
src/pkg/runtime/memmove_386.s
src/pkg/runtime/memmove_amd64.s
src/pkg/runtime/mprof.goc
src/pkg/runtime/mprof.h [new file with mode: 0644]
src/pkg/runtime/race.go
src/pkg/runtime/race0.go
src/pkg/runtime/string.go
src/pkg/runtime/stubs.go
src/pkg/runtime/stubs.goc