RE: Speed of global function
- Posted by jxliv7 at hotmail.com Aug 17, 2003
- 421 views
> Pete Lomax wrote: > >>jxliv7 wrote: >>Rob, appreciate the response. >>but it still doesn't explain how i can just change the names on your >>global routine and get completely slower consistent times. > > One thing that might possibly be happening (and trust me, I'm by no > means any kind of expert on this point) is that if you do: > > thousands of runs of a > then > thousands of runs of b > > then part way though b, the garbage collector might decide it is time > to do a little housekeeping that wasn't necessary during the run of a. > The reverse (ooh, bad pun) could also be true, that a incurs some cost > allocating quite a bit of memory, and b just reuses it. you're absolutely right, Pete, i had not even considered swapping the order of running the sections of the program... although, i just swapped places and got the same crazy results as before -- strange... > You might get a fairer comparison if you time each case in its own > program, maybe not... again, quite true, i should try that as well. good idea... > Although I accept you are probably just experimenting for a bit of > fun, it is worth saying that shaving 20% off a routine which is > already quite fast will have almost no effect whatsoever on the > performance of a larger program. > actually, it might. the routine i was trying to compact would run every now and then in the application, reversing a sequence with as many as 99,999,999 million elements. why the difference between 38 seconds and 22 seconds makes me wonder. anyway, enough of that. i'm moving on... -- jon jxliv7 at hotmail.com