]> Cypherpunks repositories - gostls13.git/commit
reflect: fix FieldByNameFunc
authorRobert Griesemer <gri@golang.org>
Tue, 13 Nov 2012 18:45:30 +0000 (10:45 -0800)
committerRobert Griesemer <gri@golang.org>
Tue, 13 Nov 2012 18:45:30 +0000 (10:45 -0800)
commitaa3880178850ab0525802a48fc4eeadcdbb2c26c
tree7adac11322b061bbfca80723e77809572323773f
parent2e77bc48aa17a60d0e0902a4cddedf7e1840a0f7
reflect: fix FieldByNameFunc

The existing algorithm did not properly propagate the type
count from one level to the next, and as a consequence it
missed collisions.

Properly propagate multiplicity (count) information to the
next level.

benchmark                old ns/op    new ns/op    delta
BenchmarkFieldByName1          182          180   -1.10%
BenchmarkFieldByName2         6273         6183   -1.43%
BenchmarkFieldByName3        49267        46784   -5.04%

Fixes #4355.

R=rsc
CC=golang-dev
https://golang.org/cl/6821094
src/pkg/reflect/all_test.go
src/pkg/reflect/type.go