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
wrote: On 8/26/06, me22
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