|
Boost : |
From: Beman Dawes (bdawes_at_[hidden])
Date: 2002-02-05 20:38:43
At 08:25 PM 2/5/2002, Darin Adler wrote:
>The fixed_* templates are almost drop-in replacements for the
>similarly-named containers in the standard library. The fixed_* versions
>are intended to be used when a fixed capacity limit is acceptable, and
>greater speed or memory efficiency is needed. Beman's timings indicated
>a speedup of as much as 8x in some cases, and the memory savings are
>significant too.
I should have added a caveat to those timings - they measured only
push_back() in the inner loop, and there was no analysis done to see
exactly where the speed difference lay.
I was looking at some generated code for std::vector just the other day,
and found (as others have also reported) that compilers do things like turn
off inlining beyond a certain function call depth. Whether or not members
are written inside the body can impact inlining (even when "inline" is
explicitly coded.) Etc, etc.
Those kinds of issues make it hard to compare code from two different
developers. Slight stylistic differences impact code optimization. It is
easy to produce timings that are really measuring something different from
what you think they are measuring.
All that being said, the speedup seem uniformly significant.
--Beman
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk