There is a theoretical (but literally negligible in practice) difference in
that the compiler has to write the pointer into the slice. But yes,
realistically, there is no difference.
On Thu, Sep 8, 2022 at 4:15 PM Mathew Murphy wrote:
> Thanks. So basically, there's no memory benefit or performa
Thanks. So basically, there's no memory benefit or performance benefit to
using nil slices over empty slices -- it's ultimately just a matter of how
you want them to serialize JSON or get written to databases?
mathew
On Wednesday, September 7, 2022 at 6:56:33 PM UTC-5 k...@google.com wrote:
>
(Actually, that address is an address on the stack, but that's only because
the backing store for emptySlice does not escape. It should also take ~no
space.)
On Wednesday, September 7, 2022 at 4:53:12 PM UTC-7 Keith Randall wrote:
> That address is not in the heap. It is the address of a specia
That address is not in the heap. It is the address of a special word in the
runtime, called runtime.zerobase, which is explicitly for this purpose. It
is a place to point things that need to be non-nil but have no size.
On Wednesday, September 7, 2022 at 12:01:28 PM UTC-7 me...@pobox.com wrote: