I use std::mapabout 20 million records to store. If they were saved without any container overhead, it would take approximately 650 MB of memory. However, since they are stored using std::map, it uses about 15 GB of memory (i.e. Too much).
The reason I use std::mapis because I need to find keys that are equal / greater / less than x. That's why something like sparsehashthis won't work (because, using this, I can't find the keys by comparison).
Is there an alternative to using std::map(or ordered cards in general), which will lead to less memory usage?
EDIT: Write performance is much more important than read performance. He will probably only read ~ 10 records, but I don’t know which records he will read.
Mijyn source
share