/ go Public
cmd/compile: deduplicate alg and noalg type descriptors to allow binary space optimizations #47904
Issues related to the Go compiler and/or runtime.
Feedback is required from experts, contributors, and/or the community before a change can be made.
The compiler supports SetNoAlg on types. This brings binary space savings by not needing to generate equality functions for those types. Applying this setting to backing arrays of slices (#32595) and maps (#47068) has introduced bugs into go binaries in the past because values of types that should be equal didnt compare equal as internally they were different types.
The general fix and even better space saving impact would be to have the compiler/linker deduplicate noalg with alg type descriptors giving preference to alg descriptors that link algorithms. See discussion with @mdempsky #47068 (comment)
Alternatively the compiler and linker combination could be smart enough to understand if algs can ever be used because the type is never exposed directly to user code. While this is more general and automatic, it would be more complex and require more work during compilation/linking instead of annotating the places where it is the case manually using SetNoAlg in the compiler.
Once this is ready we can save binary space by:
Line 306 in 457418b
Line 443 in 457418b
/cc @mdempsky @cherrymui @randall77
The text was updated successfully, but these errors were encountered: