Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You should always worry about performance and efficiency <em>when your profiler tells you so</em> (you can be that profiler, but you have to 'measure', not guess).</p> <p>Things you can do:</p> <ol> <li><p>pre-allocate capacity:</p> <pre><code> std::vector&lt;int&gt; x(1000); // size() is 1000 std::vector&lt;int&gt; y; y.reserve(1000); // size() is 0, capacity is 1000 </code></pre></li> <li><p>use a custom allocator</p> <ul> <li>have a look at <a href="http://www.boost.org/doc/libs/1_47_0/libs/pool/doc/index.html" rel="nofollow noreferrer">Boost Pool</a></li> <li>have a look at <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2271.html" rel="nofollow noreferrer">EASTL</a> (specialized for embedded/game programming) <ul> <li><a href="https://stackoverflow.com/questions/87096/stl-alternative">STL Alternative</a></li> <li><a href="https://stackoverflow.com/questions/5742597/eastl-versus-stl-how-can-there-be-such-a-performance-difference-in-stdvector">EASTL versus STL, how can there be such a performance difference in std::vector&lt;uint64_t&gt;::operator[]</a></li> </ul></li> </ul></li> </ol> <p>The first option is clearly the quick win; The second option is more involved and I only recommend it when your heap profiler tells you that fragmentation is causing problems.</p> <p>For heap profiling, I suggest</p> <ul> <li>valgrind massif (see <a href="http://valgrind.org/docs/manual/ms-manual.html#ms-manual.using" rel="nofollow noreferrer">Using Massif and ms_print</a>)</li> </ul>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload