Suggestion: Operator `in` for slices

Ola Fosheim Grøstad ola.fosheim.grostad at gmail.com
Wed Dec 29 11:26:48 UTC 2021


On Wednesday, 29 December 2021 at 10:53:13 UTC, Ola Fosheim 
Grøstad wrote:
> removing
> changed 4095 : 32768
> changed 1023 : 8192
> changed 255 : 2048
> changed 63 : 512
> changed 15 : 128
> changed 3 : 32

To put numbers on this, when deleting a long series of keys the 
hash table has consistently less than 13% filled slots, and right 
before shrinking it has 3% filled slots (1024/32768). That is a 
lot of wasted memory, 97%. Hash tables should not be worse than 
75% waste as a rule of thumb.

With such high constant factors O(1) notation is of little value.



More information about the Digitalmars-d mailing list