Boost logo

Boost :

From: Joel de Guzman (joel_at_[hidden])
Date: 2006-05-13 07:35:13


David Abrahams wrote:
> Joel de Guzman <joel_at_[hidden]> writes:
>
>> Tobias Schwinger wrote:
>>> Joel de Guzman wrote:
>>>> Tobias Schwinger wrote:
>>>>
>>> 4. Choice of datastructures
>>>
>>> I used cons lists for the tree because I figured they might be limitless and
>>> because the structure is built one element at a time.
>>> There will be a lot of traversal later -- does it make a difference / would
>>> have 'vector' been a better choice?
>> It's really hard to tell. Only testing and benchmarking will reveal
>> which to choose. I'm sure you noticed that from the recent Spirit-dev
>> tests conducted. I too get mild surprises every now and then with the
>> test results. Anyway, in general, vectors are way faster to traverse
>> and have the smallest memory (struct) footprints.
>
> Seems to me a vector can't do as well as some other structures when
> many of the elements of the tuple are empty classes.

In terms of memory footprint?

That would be true if we take advantage of empty base class
optimization for, say, cons-lists. We are not doing that yet.
I think we should. At the other extreme, if all elements are
empty, we can just use mpl::vector or mpl::list.

Regards,

-- 
Joel de Guzman
http://www.boost-consulting.com
http://spirit.sf.net

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