Given that memory overhead is critical to my application, I think that of the two options above, the latter would be more light weight. Am I correct? I am basing this on the fact that the vector has a memory overhead of 4 pointers to keep track of begin()
, end()
, size()
and allocator. So the total size for the whole model would be in the order of
(4*sizeof(T*) + sizeof(T)*Ni)*No + 3*sizeof(std::vector<T>*)
Here, I am assuming Ni
, No
to be the number of elements in the inner and outer vectors, resply. By using the latter expression, I am hoping to save the 4*sizeof(T*)*No
since in my application, No
is huge, while Ni <<<< No
. Just to fix ideas, No
is in the order of a 100
million and more, Ni
is typically in the order 3
to 50
.
Thanks in advance for your interest and any ideas.
NOTE: I understand and am more than happy to pay the price of dealing with the pointer incl. allocating, traversing, and deallocating it, and I can do so without any significant performance overhead.