Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <h2><a href="http://www.stlport.org/" rel="nofollow">STLPort</a></h2> <p>... <a href="http://stlport.git.sourceforge.net/git/gitweb.cgi?p=stlport/stlport;a=blob;f=stlport/stl/_alloc.h" rel="nofollow">seems</a> to <a href="http://stlport.git.sourceforge.net/git/gitweb.cgi?p=stlport/stlport;a=blob;f=stlport/deque" rel="nofollow">use</a>:</p> <pre><code>::: &lt;stl/_alloc.h&gt; ... enum { _MAX_BYTES = 32 * sizeof(void*) }; ... ::: &lt;deque&gt; ... static size_t _S_buffer_size() { const size_t blocksize = _MAX_BYTES; return (sizeof(_Tp) &lt; blocksize ? (blocksize / sizeof(_Tp)) : 1); } </code></pre> <p>So that would mean 32 x 4 = 128 bytes block size on 32bit and 32 x 8 = 256 bytes block size on 64 bit.</p> <p>My thought: From a size overhead POV, I guess it would make sense for any implementation to operate with variable length blocks, but I think this would be extremely hard to get right with the constant time random access requirement of <code>deque</code>.</p> <p>As for the question </p> <blockquote> <p>Does STL allow for overriding of this block size at compile-time, without modifying the code?</p> </blockquote> <p>Not possible here either.</p> <h2><a href="http://stdcxx.apache.org/" rel="nofollow">Apache</a></h2> <p>(seems to be the Rogue Wave STL version) apparently uses:</p> <pre><code>static size_type _C_bufsize () { // deque only uses __rw_new_capacity to retrieve the minimum // allocation amount; this may be specialized to provide a // customized minimum amount typedef deque&lt;_TypeT, _Allocator&gt; _RWDeque; return _RWSTD_NEW_CAPACITY (_RWDeque, (const _RWDeque*)0, 0); } </code></pre> <p>so there seems to be <em>some mechanism</em> to override the block size via specialization and the definition of ... looks like this:</p> <pre><code>// returns a suggested new capacity for a container needing more space template &lt;class _Container&gt; inline _RWSTD_CONTAINER_SIZE_TYPE __rw_new_capacity (_RWSTD_CONTAINER_SIZE_TYPE __size, const _Container*) { typedef _RWSTD_CONTAINER_SIZE_TYPE _RWSizeT; const _RWSizeT __ratio = _RWSizeT ( (_RWSTD_NEW_CAPACITY_RATIO &lt;&lt; 10) / _RWSTD_RATIO_DIVIDER); const _RWSizeT __cap = (__size &gt;&gt; 10) * __ratio + (((__size &amp; 0x3ff) * __ratio) &gt;&gt; 10); return (__size += _RWSTD_MINIMUM_NEW_CAPACITY) &gt; __cap ? __size : __cap; } </code></pre> <p>So I'd say it's, aehm, complicated.</p> <p>(If anyone feels like figuring this out further, feel free to edit my answer directly or just leave a comment.)</p>
    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.
    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