[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: Performance again



Herwin Jan Steehouwer wrote:
> 
> oops, i forgot the source :
> 

Herwin,

I ran your test on my 533 PC164LX but the loop was
optimized out of the code. All tests, i/f/d were
0.03 seconds WCT. So, you need a little change
to the test t make the compiler run the loops.

Just print out the last value of val1 in your
print statements. This forces the compiler to
really calculate the loop. I got the following 
results with that change:


[wsb@wsb5 home]$ time preftest d
double val1=2 
0.24user 0.00system 0:00.25elapsed 98%CPU (0avgtext+0avgdata 0maxresident)k
0inputs+0outputs (68major+13minor)pagefaults 0swaps
[wsb@wsb5 home]$ time preftest i
mixed int val1=2.000000
2.01user 0.00system 0:02.02elapsed 99%CPU (0avgtext+0avgdata 0maxresident)k
0inputs+0outputs (68major+13minor)pagefaults 0swaps
[wsb@wsb5 home]$ time preftest f
float val1=2.000000 
0.18user 0.00system 0:00.18elapsed 98%CPU (0avgtext+0avgdata 0maxresident)k
0inputs+0outputs (68major+13minor)pagefaults 0swaps

Also, I used gcc -O2 : 

gcc version egcs-2.90.29 980515 (egcs-1.0.3 release)

Watch out though how you use the results. This test is
way too simple to represent a real application. Most
likely almost all the work was moved out of the loop
because it doesn't vary from iteration to iteration.


Wes



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index] []