Skip to content

Do not embed reflect.Type to avoid supressing DCE#73

Merged
jszwec merged 1 commit intojszwec:masterfrom
ikonst:master
Mar 15, 2025
Merged

Do not embed reflect.Type to avoid supressing DCE#73
jszwec merged 1 commit intojszwec:masterfrom
ikonst:master

Conversation

@ikonst
Copy link
Contributor

@ikonst ikonst commented Mar 15, 2025

It's a known artifact of go's linker that referencing Method or MethodByName anywhere in the code suppresses dead-code elimination for public methods for the entire program. This includes embedding reflect.Type, since that references Method and MethodByName. By simply not embedding reflect.Type, we avoid that.

@jszwec jszwec merged commit b9b8496 into jszwec:master Mar 15, 2025
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants