cmd/compile: small struct initialization code is suboptimal because of redundant zeroing #59021
Labels
compiler/runtime
Issues related to the Go compiler and/or runtime.
NeedsInvestigation
Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Performance
Milestone
What version of Go are you using (
go version
)?Also tested:
go1.21-f5c7416511
,go1.19
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?
https://go.dev/play/p/KYZ1WC9j4VP
https://go.godbolt.org/z/1KMEo5nP8 (note: uses Go 1.19)
What did you expect to see?
Compiler should generate the same code for
new(T)
and&T{}
.What did you see instead?
new(T)
compiles tobut
&T{}
compiles toBig structures like this
are not affected.
The text was updated successfully, but these errors were encountered: