3 ms·
It was a design goal that monomorphization should always be possible, but Go will not be monomorphizing generic functions to save on compile time / binary bloat
by uluyol 5y ago
It was a design goal that monomorphization should always be possible, but Go will not be monomorphizing generic functions to save on compile time / binary bloat (it will instead use GCShape stenciling, see below). I suspect future releases will be smarter and monomorphize some functions for performance, but that's really up to the Go team.
Initial implementation strategies considered for generics:
https://github.com/golang/proposal/blob/master/design/generics-implementation-stenciling.md https://github.com/golang/proposal/blob/master/design/generi...
https://github.com/golang/proposal/blob/master/design/generics-implementation-dictionaries.md https://github.com/golang/proposal/blob/master/design/generi...
https://github.com/golang/proposal/blob/master/design/generics-implementation-gcshape.md https://github.com/golang/proposal/blob/master/design/generi...