[old post...bumping]

why not delete(map) with the obvious meaning

On Mon, Aug 13, 2018 at 7:43 AM Peter Edge <peter.e...@gmail.com> 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 <rogpe...@gmail.com> 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.11#performance-compiler
>>
>>
>> On 12 August 2018 at 11:07, Peter Edge <peter.e...@gmail.com> wrote:
>> > 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)
>> > }
>> >
>> > But this doesn't seem to work, I still see allocations (and it causes a
>> > significant performance hit, which makes sense).
>> >
>> > Even something similar to https://golang.org/cl/137880043 if we had to
>> clear
>> > the actual values would be great.
>> >
>> > --
>> > You received this message because you are subscribed to the Google
>> Groups
>> > "golang-nuts" group.
>> > To unsubscribe from this group and stop receiving emails from it, send
>> an
>> > email to golang-nuts+unsubscr...@googlegroups.com.
>> > For more options, visit https://groups.google.com/d/optout.
>>
> --
> You received this message because you are subscribed to the Google Groups
> "golang-nuts" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to golang-nuts+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>


-- 

*Michael T. jonesmichael.jo...@gmail.com <michael.jo...@gmail.com>*

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to