mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-05-06 01:50:38 +00:00
Change rdcarray resize strategy to exponential instead of minimal
* Normally this wasn't a problem but in a few cases we were doing lots of push_back calls and this caused horrible resize-by-1 behaviour. * So instead we double the available count (if that's larger than just satisfying the request).
This commit is contained in:
@@ -176,7 +176,11 @@ public:
|
||||
if(s <= capacity())
|
||||
return;
|
||||
|
||||
// for now, just resize exactly to what's needed.
|
||||
// either double, or allocate what's needed, whichever is bigger. ie. by default we double in
|
||||
// size but we don't grow exponentially in 2^n to cover a single really large resize
|
||||
if(size_t(allocatedCount) * 2 > s)
|
||||
s = size_t(allocatedCount) * 2;
|
||||
|
||||
T *newElems = allocate(null_terminator<T>::allocCount(s));
|
||||
|
||||
// copy the elements to new storage
|
||||
|
||||
Reference in New Issue
Block a user