Chromium Code Reviews| Index: Source/wtf/Vector.h |
| diff --git a/Source/wtf/Vector.h b/Source/wtf/Vector.h |
| index ab18fe5fe421fae435d5627c5adcc6542d981021..cb1b4adb54e22ecd589687ae3f698286f7ccfc2f 100644 |
| --- a/Source/wtf/Vector.h |
| +++ b/Source/wtf/Vector.h |
| @@ -675,6 +675,11 @@ static const size_t kInitialVectorSize = WTF_VECTOR_INITIAL_SIZE; |
| void reserveCapacity(size_t newCapacity); |
| void reserveInitialCapacity(size_t initialCapacity); |
| void shrinkToFit() { shrinkCapacity(size()); } |
| + void shrinkToReasonableCapacity() |
|
Mikhail
2014/04/16 08:29:14
Is this method supposed to be called so frequently
danakj
2014/04/16 15:55:06
shrinkCapacity() is currently private, so this nee
|
| + { |
| + if (UNLIKELY(size() * 2 < capacity())) |
|
abarth-chromium
2014/04/16 00:58:38
Sorry to leave a drive-by comment, but please don'
ostap
2014/04/16 16:11:02
Thanks.
I tested. It really makes no difference.
|
| + shrinkCapacity(size() + size() / 4 + 1); |
| + } |
| void clear() { shrinkCapacity(0); } |