Memory Efficient HashSet

Martin Tschierschke via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Thu Mar 10 02:15:10 PST 2016


On Wednesday, 9 March 2016 at 22:31:50 UTC, Nordlöw wrote:
[...]
>     foreach (const i; iota(0, n))
>     {
>         x[i] = true; // indicate that it's stored
>     }
>
>     import std.stdio : writeln, readln;
>     writeln("Press return: ");
>     readln;
> }
>
> consumes 842.m MiB on my Ubuntu.
>
> The consumption with Google's sparsehash unordered_set is about 
> 50 MiB.
May be the discussion associated with this post, can give help???
https://forum.dlang.org/post/mailman.217.1457590242.26339.digitalmars-d-bugs@puremagic.com


I tried your little program and played around. I tried x.rehash, 
but this resulted in even more memory consumption. 80 bytes for 4 
bytes key and one bit storage seams a lot.
With smaller n it comes down to app. 60 Bytes.

With how many data sets at the end, you will have to deal?


More information about the Digitalmars-d-learn mailing list