-
-
Couldn't load subscription status.
- Fork 4.1k
Open
Labels
Description
Commit 725aa5b has replaced the function callBackToMethodValue() with a plain modelValue.MethodByName(string(cbName)), which makes it impossible for the go linker to run dead code elimination.
The comment on callBackToMethodValue() clearly describes why that function was important for the DCE:
// This unrolling is needed to show to the compiler the exact set of methods
// that can be used on the modelType.
// Prior to go1.22 any use of MethodByName would cause the linker to
// abandon dead code elimination for the entire binary.
// As of go1.22 the compiler supports one special case of a string constant
// being passed to MethodByName. For enterprise customers or those building
// large binaries, this gives a significant reduction in binary size.
// https://github.com/golang/go/issues/62257