• Kyle Consalus's avatar
    runtime: special case copy, equal for one-word interface values · 4d903504
    Kyle Consalus authored
    Based on the observation that a great number of the types that
    are copied or compared in interfaces, maps, and channels are
    word-sized, this uses specialized copy and equality functions
    for them that use a word instead of 4 or 8 bytes. Seems to yield
    0-6% improvements in performance in the benchmarks I've run.
    For example, with the regexp benchmarks:
    
    Before:
    regexp.BenchmarkLiteral   500000       3.26 µs/op
    regexp.BenchmarkNotLiteral    100000      13.67 µs/op
    regexp.BenchmarkMatchClass    100000      18.72 µs/op
    regexp.BenchmarkMatchClass_InRange    100000      20.04 µs/op
    regexp.BenchmarkReplaceAll    100000      27.85 µs/op
    
    After:
    regexp.BenchmarkLiteral   500000       3.11 µs/op
    regexp.BenchmarkNotLiteral    200000      13.29 µs/op
    regexp.BenchmarkMatchClass    100000      17.65 µs/op
    regexp.BenchmarkMatchClass_InRange    100000      18.49 µs/op
    regexp.BenchmarkReplaceAll    100000      26.34 µs/op
    
    R=rsc
    CC=golang-dev
    https://golang.org/cl/1967047
    4d903504
Name
Last commit
Last update
..
Makefile Loading commit data...
align.c Loading commit data...
bisonerrors Loading commit data...
bits.c Loading commit data...
builtin.c.boot Loading commit data...
closure.c Loading commit data...
const.c Loading commit data...
cplx.c Loading commit data...
dcl.c Loading commit data...
doc.go Loading commit data...
export.c Loading commit data...
gen.c Loading commit data...
go.errors Loading commit data...
go.h Loading commit data...
go.y Loading commit data...
init.c Loading commit data...
lex.c Loading commit data...
md5.c Loading commit data...
md5.h Loading commit data...
mkbuiltin Loading commit data...
mkbuiltin1.c Loading commit data...
mkopnames Loading commit data...
mparith1.c Loading commit data...
mparith2.c Loading commit data...
mparith3.c Loading commit data...
obj.c Loading commit data...
print.c Loading commit data...
range.c Loading commit data...
reflect.c Loading commit data...
runtime.go Loading commit data...
select.c Loading commit data...
sinit.c Loading commit data...
subr.c Loading commit data...
swt.c Loading commit data...
typecheck.c Loading commit data...
unsafe.c Loading commit data...
unsafe.go Loading commit data...
walk.c Loading commit data...