Re: removing a loop cause it to go at half the speed?



Vladimir S. Oka wrote:
On Wednesday 15 March 2006 16:14, tom fredriksen opined (in
<44183d6e$1@xxxxxxxxxxxxxxxxx>):
I was doing a simple test of the speed of a "maths" operation and when
I tested it I found that removing the loop that initialises the data
array for the operation caused the whole program to spend twice the
time to complete. If the loop is included it takes about 7.48 seconds
to complete, but when removed it takes about 11.48 seconds.

Does anybody have a suggestion as to why this is so and whether I can
trust the results of the code as it is below?

I'd suggest brushing up on your algebra. Since when is 11.48 "twice the"
7.48? In my book it's closer to 50% larger ("twice larger" being 100%).

I did not say twice the larger, I said twice the time:/

/tom
.



Relevant Pages

  • Re: removing a loop cause it to go at half the speed?
    ... tested it I found that removing the loop that initialises the data array ... If the loop is included it takes about 7.48 seconds to ... It is because of the virtual memory system. ...
    (comp.lang.c)
  • Re: removing a loop cause it to go at half the speed?
    ... tested it I found that removing the loop that initialises the data array ... Your program causes undefined behaviour if you remove the ... your loop, ...
    (comp.lang.c)
  • Re: removing a loop cause it to go at half the speed?
    ... tested it I found that removing the loop that initialises the data array ... If the loop is included it takes about 7.48 seconds to ... int main ... the array data[] is signed and when unitialized the summation ...
    (comp.lang.c)
  • Re: removing a loop cause it to go at half the speed?
    ... I tested it I found that removing the loop that initialises the data array for the operation caused the whole program to spend twice the time to complete. ... Without the initialisation, 1/4 of the array-accesses will result in a cache miss, and the processor will have to wait for the bus to grab the data from RAM. ...
    (comp.unix.programmer)
  • Re: removing a loop cause it to go at half the speed?
    ... I was doing a simple test of the speed of a "maths" operation and when I ... tested it I found that removing the loop that initialises the data array ...
    (comp.lang.c)