Boost logo

Boost Users :

From: Dave Steffen (dgsteffen_at_[hidden])
Date: 2006-08-28 12:57:24


Brian Budge writes:
> This is most likely that you are not getting your operator[] inlined.
> The function call overhead for such a small operation is going to be
> very large. Optimizations are your friends.
> On 8/26/06, Janos Vegh <vegh.janos_at_[hidden]> wrote:
> >
> >
> >
> > On 8/26/06, me22 <me22.ca_at_[hidden]> wrote:
[...]

> > > Empty cycle
> > > real 0m0.003s
> > > user 0m0.000s
> > > sys 0m0.000s
> > >
> > > STL=1, SIMPLE=1, size=1000
> > > real 0m1.357s
> > > user 0m1.168s
> > > sys 0m0.008s
> > >
> > > STL=1, size=1000
> > > real 0m1.337s
> > > user 0m1.172s
> > > sys 0m0.016s
[...]

A comment on this sort of thing: using a shell's "time" is merely an
OK way to measure performance -- OK, but not great.

I strongly suggest that the OP, and anybody else interested in such
things, go get a recent verson of valgrind. The 'callgrind' tool
counts the number of instructions execuded, which is a much more
accurate and reliable measure. Also, get kcachegrind (a plug-in for
KDE); together with callgrind, it'll tell you instruction counts on a
line-by-line basis. (The usual caveats apply.)

If you can't use valgrind on your platform, then I strongly suggest
you aquire some other good profiling tool, such as VTune.

Trust me, you'll get much, much better and more consistent results
this way.

----------------------------------------------------------------------
Dave Steffen, Ph.D.
Software Engineer IV Disobey this command!
Numerica Corporation - Douglas Hofstadter
dgsteffen at numerica dot us


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net