On 10/1/23 1:13 PM, dhs wrote:

It may not be a problem in practice. My concern was performance, because each time we add an element to the array, the garbage collector has to map the slice to the allocation it belongs to.

FWIW, there is a cache that makes this decently fast, so it doesn't have to go all the way into the GC to get all the information for every append.

But it *most definitely* not going to be as fast as reading a local "capacity" variable.

-Steve

Reply via email to