Boost logo

Boost :

Subject: Re: [boost] sentinels vs iterators
From: Mathias Gaunard (mathias.gaunard_at_[hidden])
Date: 2014-08-23 10:39:14


On 21/08/2014 12:12, Joaquin M Lopez Munoz wrote:
> Some
> months ago I explored a container-like construct for polymorphic
> objects that group elements by run-time type so as to greatly
> speed up for_each processing:
>
> http://bannalia.blogspot.com.es/2014/05/fast-polymorphic-collections.html

IMHO you're comparing oranges and apples, the memory layout and
traversal properties are entirely different.

Your structure has a varying number of elements, all of different sizes,
which isn't directly compatible with the memory representation of a
vector and therefore requires indirection and fragmentation (unique_ptr).

If you want to do a more fair comparison, it would be interesting to try
to keep the same memory layout but just in a different order, for
example using instruvie linked lists, to see whether it is indeed the
branch prediction of the vtable that gives you those benefits.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk