]> Cypherpunks repositories - gostls13.git/commit
gc: optimize interface ==, !=
authorRuss Cox <rsc@golang.org>
Sat, 11 Feb 2012 05:19:24 +0000 (00:19 -0500)
committerRuss Cox <rsc@golang.org>
Sat, 11 Feb 2012 05:19:24 +0000 (00:19 -0500)
commitf91cc3bdbbdad81a4d2be5833a6a1816355d93e1
tree3c858e4187019568eb5094005f2aa668388e5391
parenta7b83f2287bc650e8479445bbe5008e9ccec12ba
gc: optimize interface ==, !=

If the values being compared have different concrete types,
then they're clearly unequal without needing to invoke the
actual interface compare routine.  This speeds tests for
specific values, like if err == io.EOF, by about 3x.

benchmark                  old ns/op    new ns/op    delta
BenchmarkIfaceCmp100             843          287  -65.95%
BenchmarkIfaceCmpNil100          184          182   -1.09%

Fixes #2591.

R=ken2
CC=golang-dev
https://golang.org/cl/5651073
src/cmd/5g/cgen.c
src/cmd/5g/gsubr.c
src/cmd/6g/cgen.c
src/cmd/6g/gsubr.c
src/cmd/8g/cgen.c
src/cmd/8g/gsubr.c
src/cmd/gc/go.h
src/cmd/gc/typecheck.c
src/cmd/gc/walk.c
src/pkg/runtime/runtime_test.go [new file with mode: 0644]