Remove maximal reallocation size in wxVector
This dramatically pessimizes performance for large vector sizes and doesn't actually save that much memory because all intermediate allocations are still being used by the process, so follow stdlibc++ example and just double the allocated buffer size without limit.
This commit is contained in:
@@ -315,10 +315,8 @@ public:
|
|||||||
//
|
//
|
||||||
// NB: casts to size_type are needed to suppress warnings about
|
// NB: casts to size_type are needed to suppress warnings about
|
||||||
// mixing enumeral and non-enumeral type in conditional expression
|
// mixing enumeral and non-enumeral type in conditional expression
|
||||||
const size_type increment = m_size > 0
|
const size_type increment = m_size > ALLOC_INITIAL_SIZE
|
||||||
? m_size < ALLOC_MAX_SIZE
|
|
||||||
? m_size
|
? m_size
|
||||||
: (size_type)ALLOC_MAX_SIZE
|
|
||||||
: (size_type)ALLOC_INITIAL_SIZE;
|
: (size_type)ALLOC_INITIAL_SIZE;
|
||||||
if ( m_capacity + increment > n )
|
if ( m_capacity + increment > n )
|
||||||
n = m_capacity + increment;
|
n = m_capacity + increment;
|
||||||
@@ -491,7 +489,6 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
static const size_type ALLOC_INITIAL_SIZE = 16;
|
static const size_type ALLOC_INITIAL_SIZE = 16;
|
||||||
static const size_type ALLOC_MAX_SIZE = 4096;
|
|
||||||
|
|
||||||
void Copy(const wxVector& vb)
|
void Copy(const wxVector& vb)
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user