[old post...bumping]
why not delete(map) with the obvious meaning
On Mon, Aug 13, 2018 at 7:43 AM Peter Edge wrote:
> Yes, actually saw that a bit after I sent this email. Thanks for the link
> though, appreciate it :-)
>
> On Mon, Aug 13, 2018 at 11:08 AM roger peppe wrote:
>
>> I believe thi
Yes, actually saw that a bit after I sent this email. Thanks for the link
though, appreciate it :-)
On Mon, Aug 13, 2018 at 11:08 AM roger peppe wrote:
> I believe this optimisation has been implemented now.
> Have you tried using Go 1.11 beta (or Go tip) ?
> See https://tip.golang.org/doc/go1.1
I believe this optimisation has been implemented now.
Have you tried using Go 1.11 beta (or Go tip) ?
See https://tip.golang.org/doc/go1.11#performance-compiler
On 12 August 2018 at 11:07, Peter Edge wrote:
> With slices, you can do
>
> slice = slice[:0]
>
> to remove the values from the slice,
With slices, you can do
slice = slice[:0]
to remove the values from the slice, but keep the backing slice with the
same capacity (although the elements aren't marked for GC I believe, if
that's a concern). With maps, is there a similar pattern? I've tried:
for key := range m {
delete(m, key)