Given the MyData structure from which there are many instances (I would say several million), for each instance I need to save an element that can contain values up to 8 keys. The key will always be int ranged 0-7 , and the values will always be the three-dimensional point of the floats (let's call it Point3 ).
At maximum, it will contain:
Key | Value ------------- 0 | [x,y,z] 1 | [x,y,z] 2 | [x,y,z] 3 | [x,y,z] 4 | [x,y,z] 5 | [x,y,z] 6 | [x,y,z] 7 | [x,y,z]
However, in 99.9% of cases it will contain 0 or 1 key-value pairs, for example:
Key | Value ------------- 1 | [x,y,z]
How can I effectively determine the memory overhead, if any, to keep empty or unambiguous std::map<int, Point3> , compared to always storing an array of 8 Point3 (4 bytes per float * 3 values * 8 slots = 96 bytes) and one BYTE with bits for which slots contain significant values?
In general, my question is: what is the memory overhead on an empty or almost empty std::map ?