News for hackers. Stuff that matters.
Re:Go Protobuf: The New Opaque API by 9rx on Tuesday December 17, 2024 @02:10PM (#42444257)
The heap allocation could transparently happen at use. The only additional performance overhead that would bring is the conditional around if it has already been initialized or not, which is negligible for modern computers. Go is not obsessed with eking every last bit of performance anyway.

But, that is not the convention. It is well understood that if a struct needs allocations that you must first call a constructor function (e.g. package.NewFoo). It is reasonable to expect that map would stick to the same convention.

There are no comments on this comment yet.