RE: The strange speed of a program!

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

 



bear wrote:

> What supprise me a lot is the code with initialization(io==1) is
> much faster than without initialization(io!=1). The initialization
> code should takes some time and it should slow down the program.
> But the result confuse me. Why?

Oddly, I see the opposite:

    ./basic 50 1024 0
    CPU time: 4.190000 sec
    ./basic 50 1024 1
    CPU time: 9.930000 sec

compiled 3.3.6, -O0, Pentium II, Fedora Core 3.

My best guess would be that in the uninitialized case, since you don't
initialise s0-s3 at all, you're performing computation on the random data
left in your allocated memory and these are slower than the simple
calculations based on real values. But I can't reproduce that here, and in
my tests zeroing s0-s3 after allocating them makes negligible difference.

Rup.


[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux