diff options
author | Sergei Zagurskii <gvozdoder@gmail.com> | 2019-05-22 17:00:34 +0300 |
---|---|---|
committer | Brad Fitzpatrick <bradfitz@golang.org> | 2019-08-27 16:44:22 +0000 |
commit | 8057c0887f89701b3091755d986b534fd8a50fc7 (patch) | |
tree | bfa6d2c398719b4def1a2c443b0ca589bda83a20 /test | |
parent | dca0d03b9c9ad20de743bd8ac4cd4b2b466713a3 (diff) | |
download | go-git-8057c0887f89701b3091755d986b534fd8a50fc7.tar.gz |
reflect: optimize directlyAssignable to avoid rtype.Name call
directlyAssignable invoked rtype.Name() just to compare its result
to empty string. We really only need to check whether rtype has
name. It can be done much cheaper, by checking tflagNamed.
Benchmark: https://play.golang.org/p/V2BzESPuf2w
name old time/op new time/op delta
DirectlyAssignable-12 32.7ns ± 6% 6.6ns ± 6% -79.80% (p=0.008 n=5+5)
Fixes #32186
Change-Id: I1a2a167dbfddf319fba3015cb6a011bf010f99a8
Reviewed-on: https://go-review.googlesource.com/c/go/+/178518
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Diffstat (limited to 'test')
0 files changed, 0 insertions, 0 deletions