You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There's no such problem if i change func getValue(foo Foo) interface{} to func getValue(foo *Foo) interface{}. But we already have a lot of codes using getValue(foo). and it's difficult to change parameter type.
What did you expect to see?
The asm code of testGetField1 and testGetField2 should be same.
Why this kind of code can not be optimized?
Is there any other way i can optimize it without change parameter type?
The text was updated successfully, but these errors were encountered:
Go version
go version go1.23.0 linux/amd64
Output of
go env
in your module/workspace:What did you do?
I need to get field
v
from a value of typeFoo
, seetestGetField1
andtestGetField2
.What did you see happen?
I'm sure that
getValue
is inlined but thetestGetField2
method has many useless copies.There's no such problem if i change
func getValue(foo Foo) interface{}
tofunc getValue(foo *Foo) interface{}
. But we already have a lot of codes usinggetValue(foo)
. and it's difficult to change parameter type.What did you expect to see?
The asm code of
testGetField1
andtestGetField2
should be same.Why this kind of code can not be optimized?
Is there any other way i can optimize it without change parameter type?
The text was updated successfully, but these errors were encountered: