3 ms·
To fight fragmentation, a deque-like container is probably better anyway. Very good point on 3.
by gpderetta 6y ago
To fight fragmentation, a deque-like container is probably better anyway.
Very good point on 3.
- MauranKilom 6y agoIndeed. I recently looked at using std::deque because I was exactly trying to avoid allocating too much contiguous memory, fearing fragmentation. Sadly, std::deque is pretty much useless. It uses something like page-sized blocks in one implementation, a few cachelines in another one (forgot which is gcc/clang), and on MSVC it allocates every single item separately (!!!) for element size > 1 word. And this will not be changed due to ABI compatibility. It might as well not exist in the standard.
- gpderetta 6y agoyes, I never use std::deque for the same reason. I believe that the deque in boost these days has a compile time configurable block size.