Yes, it's the simplest and probably the fastest way (and I care about
simplicity more than speed anyway), so I like it more than the other
option.
It seems there's no third one, except from replacing ohash or forking it
(f.e. to not downsize unless explicitly requested).
I think I'll stay with the simplest option (just fix the bug in my code)
for now.
Thanks to everybody for the answers
Maciej Admczyk

------------------------------------------------------------------------

From: Ted Unangst
Sent: Wednesday, January 04, 2017 7:16PM
To: Maciej Adamczyk
Cc: Misc
Subject: Re: The right way to delete elements from ohash

Maciej Adamczyk wrote:  

  The task is simple: remove all elements that satisfy some property.  

  * add another layer of looping and keep iterating as long as a pass over 
  the map deleted at least one element.

this should be fast enough. even with looping and resizing, it's
asymptotically linear.

Reply via email to