On 8/26/06, me22 <me22.ca@gmail.com> wrote:

main has to return int; Your code isn't legal C++.  Also, it seems
like you end up using memory in the vector after only reserving it,
not resizing it.

Yes, a forgotten  int, my mistake.
After reserving the  memory, I guess I can  write the memory  locations.
I think neither of the above affects the subject.

Your empty cycle time makes it obvious you're not even doing the most
rudimentary of optimizations.

My goal was to measure the time of the empty processing,
in order to estimate the time of the net calculation,
rather than to find out that for no operation I need no time.

Here's what I get in g++ (g++ (GCC) 4.1.1 (Gentoo 4.1.1)) after making
a few changes while using -O3 -DNDEBUG as arguments to the compiler
(though -DNDEBUG didn't make any signifigant difference):

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

STL=1, ITERATOR=1, size=1000
real    0m1.315s
user    0m1.172s
sys     0m0.012s

STL=1, AT=1, size=1000
real    0m1.357s
user    0m1.176s
sys     0m0.004s

I really don't see an issue here.

I neither, except that it looks like that in the case of AT checking the lower and upper
limits of the index needs no extra time(??).

Otherwise, on my system
$ g++ -oeffic2.exe effic2.cpp
$ time ./effic2.exe
STL=1, SIMPLE=1, ITERATOR=0, AT=0, size=1000
real    0m4.775s
user    0m4.476s
sys     0m0.080s

$ g++ -o3 -oeffic2.exe effic2.cpp
$ time ./effic2.exe
STL=1, SIMPLE=1, ITERATOR=0, AT=0, size=1000
real    0m4.749s
user    0m4.496s
sys     0m0.060s

and

$ g++ -o3 - oeffic2.exe effic2.cpp
$ time ./effic2.exe
STL=1, SIMPLE=0, ITERATOR=0, AT=0, size=1000
real    0m33.413s
user    0m32.076s
sys     0m0.100s

$ g++ -oeffic2.exe effic2.cpp
$ time ./effic2.exe
STL=1, SIMPLE=0, ITERATOR=0, AT=0, size=1000
real    0m34.554s
user    0m33.668s
sys     0m0.060s

and

$ g++ -oeffic2.exe effic2.cpp
$ time ./effic2.exe
STL=1, SIMPLE=0, ITERATOR=0, AT=1, size=1000
real    1m26.753s
user    1m24.301s
sys     0m0.080s

$ g++ -o3 -oeffic2.exe effic2.cpp
$ time ./effic2.exe
STL=1, SIMPLE=0, ITERATOR=0, AT=1, size=1000
real    1m29.311s
user    1m27.035s
sys     0m0.050s

After that you were so kind to run my  test on your Linux,
maybe I need to ask MingW people about this  problem.

Anyhow, thanks for replying and sorry for bothering the list with my problem

Janos