]> Cypherpunks repositories - gostls13.git/commit
runtime: unify memeq and memequal
authorKeith Randall <khr@golang.org>
Mon, 22 Feb 2016 21:20:38 +0000 (13:20 -0800)
committerKeith Randall <khr@golang.org>
Tue, 23 Feb 2016 00:15:38 +0000 (00:15 +0000)
commitbd70bd9cb2f458b23222083a3a11190f080af7fd
tree77c35258aea9e50c677841ef02af3b6a63871c10
parent1e00cc1647916b705682f8721b8a9e9e095bf4ee
runtime: unify memeq and memequal

They do the same thing, except memequal also has the short-circuit
check if the two pointers are equal.

A) We might as well always do the short-circuit check, it is only 2 instructions.
B) The extra function call (memequal->memeq) is expensive.

benchmark                 old ns/op     new ns/op     delta
BenchmarkArrayEqual-8     8.56          5.31          -37.97%

No noticeable affect on the former memeq user (maps).

Fixes #14302

Change-Id: I85d1ada59ed11e64dd6c54667f79d32cc5f81948
Reviewed-on: https://go-review.googlesource.com/19843
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
src/runtime/alg.go
src/runtime/asm_386.s
src/runtime/asm_amd64.s
src/runtime/asm_amd64p32.s
src/runtime/asm_arm.s
src/runtime/asm_arm64.s
src/runtime/asm_mips64x.s
src/runtime/asm_ppc64x.s
src/runtime/hashmap_fast.go
src/runtime/string_test.go
src/runtime/stubs.go