10 ms·
Go does many small allocations behind the scenes. A "select" with more than one case does some allocation. The Go compiler generates special-case code for a si
by Animats 12y ago
Go does many small allocations behind the scenes. A "select" with more than one case does some allocation. The Go compiler generates special-case code for a single-case select. More than one case uses a complicated N-case library function that does some allocation.
Passing a parameter as an "interface{}", or creating a slice, also causes the creation of temporary objects, which are usually (always?) on the heap. This may or may not be a big problem depending on how the allocator and garbage collector work. Anyone know?