reflect: directlyAssignable doesn't need rtype.Name() #32186
Labels
FrozenDueToAge
NeedsFix
The path to resolution is known, but the work has not been done.
Performance
Milestone
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes.
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
Benchmark: https://play.golang.org/p/V2BzESPuf2w
Benchmark results:
What did you expect to see?
I honestly expect
AssignableTo
to be as fast as possible.What did you see instead?
I see that
AssignableTo
invokesdirectlyAssignable
. AnddirectlyAssignable
performs more work than it really needs.directlyAssignable
retrieves rtype names and checks whether they are equal to empty string. Retrieving the names isn't required for that. We can just check the flagtflagNamed
.The text was updated successfully, but these errors were encountered: