cmd/compile: unnecessary hash/eq functions for slice literals #30449
Labels
binary-size
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.
ToolSpeed
Milestone
What version of Go are you using (
go version
)?Consider this package:
$ go build -o bloat.a . $ ls -l bloat.a -rw-r--r-- 1 dneil primarygroup 778 Feb 27 15:23 bloat.a
Now consider the case where we initialize the var
x
:$ go build -o bloat.a . $ ls -l bloat.a -rw-r--r-- 1 dneil primarygroup 4030 Feb 27 15:28 bloat.a
The object file for the latter package contains
eq
andhash
functions for[3]interface{}
, which appear to account for much of the size increase:There is no need for these functions, however; the only use of
[3]interface{}
is to initialize a[]interface{}
, and there is no way to recover the array type from that slice.The text was updated successfully, but these errors were encountered: