r/cpp • u/igaztanaga • Apr 07 '26
Inside Boost.Container: comparing different deque implementations
I put together a comparison of std::deque internals across libc++, libstdc++, MSVC STL, and boost::container::deque (Boost 1.90). The article looks at the internal data structures, member layouts, sizeof(deque), and includes some benchmarks on common operations.
Boost 1.90 shipped a complete rewrite of its deque — the old SGI-derived layout was replaced with a more compact design (32 bytes vs the previous 80). The article digs into what changed, how the new implementation compares to the three standard library implementations, and how much block size alone affects performance across all of them.
https://boostedcpp.net/2026/03/30/deque/
Note: thanks to the info provided by u/HowardHinnant, I've update the article with additional info about the noexcept-ness of default and move constructors across implementations.
View all comments
Show parent comment
4
u/igaztanaga Apr 09 '26
Right. boost::container::deque will expose the block (segment) and local iterators in the future. I'm experimenting with the good old segmented iterators proposal from Matt Austern:
https://lafstern.org/matt/segmented.pdf
And preliminary test show that the speed up can be dramatic in some algorithms. And yes, you can get auto-vectorization, especially with clang, achieving, for some corners cases, a 10x improvement if the compiler can auto-vectorize operations when the "local iterator" is a raw pointer. I plan to write some articles about this.
Regarding the "jagged vector" data structure, it will probably be added to the Boost Container collection in the future, but like with some recent re-written data structures (say, the new unordered/hash containers), it would need some time to analyze and benchmark design alternatives first... Is there any open source "jagged vector" implementation you would like to share or promote as a "reference" implementation?