c++ - Perfomance Impact of Nested Vectors vs. Contiguous Arrays -


have there been reliable tests display performance differences between accessing , writing nested vectors versus c++'s built-in arrays? i've heard using nested (multi-dimensional) vectors typically have performance overhead compared accessing elements in single array (where elements stored in contiguous memory), seems hypothetical me. have yet see tests show these differences. significant? i'm sure depends on scenario, inexperienced programmer, i'm not quite sure @ level these differences become significant.

it depends on scenario, extent don't think it's possible answer in general way approach fastest. fastest approach going 1 access patterns have best data locality - depends highly on access pattern how structures laid out in memory, in case of nested vectors dependent on allocator , varies quite bit between compilers.

i'd follow general rule of optimization, first write things in straightforward way , attempt optimization when can prove there bottleneck.


Comments

Popular posts from this blog

Is there a better way to structure post methods in Class Based Views -

performance - Why is XCHG reg, reg a 3 micro-op instruction on modern Intel architectures? -

jquery - Responsive Navbar with Sub Navbar -