[ODE] RE: ALLOCA

Gerhard Wesp gwesp at cosy.sbg.ac.at
Fri Feb 27 14:49:17 MST 2004


On Fri, Feb 27, 2004 at 01:28:02PM +0100, Pierre Terdiman wrote:
> Depends on your app, really.

Depends on the compiler/library/CPU combination/compiler settings, really.

> Have a look at generated assembly (*) for a simple "push_back()" (for a

push_back() is typically not needed once your data structures are set
up, i.e. in the realtime part of the application.  Plus, I'd first try a
profiler to find out what CPU time percentage my push_back()'s _really_
consume.

Normally I'd expect that 99.999% of time is spent in operator[], which
will typically be just as fast as for builtin arrays/arrays allocated by
new[]/std::valarray<>/whatever.

Of course, if you have fixed sizes, std::vector<> is overkill.  In this
case I use builtin arrays or boost::array<>.

> (*) Or check out attached file (VC++ 6 / latest service pack)

Hmmm...  This compiler is about 6 years old and not very well-reputed
for it's C++ standard library.  Wouldn't you want to try a recent
compiler with full optimization turned on?

Kind regards from Duebendorf :-)
-Gerhard
-- 
Gerhard Wesp             o o           Tel.: +41 (0) 43 5347636
Bachtobelstrasse 56       |       http://www.cosy.sbg.ac.at/~gwesp/
CH-8045 Zuerich          \_/


More information about the ODE mailing list