in reply to Re: Re: Reading from the end of a file.
in thread Reading from the end of a file.

There's no need to do any "prerunning" to avoid penalties for a first run. If the first argument to timethese (and hence, to cmpthese) is negative, Benchmark will run the code for at least that number of seconds. But in order to know how many times the code needs to be run, it will first run the code several times to get an indication how often it needs to run to satisfy the requirement. So, any first run penalties have already been paid.

Of course, if there's a significant difference between a first run and any subsequent runs, the use of the Benchmark module is isn't very useful anyway.

Abigail

Replies are listed 'Best First'.
Re: Re: Reading from the end of a file.
by BrowserUk (Patriarch) on May 21, 2004 at 00:04 UTC

    That's pretty much what I thought, though not in the detail. I had a vague idea that I read somewhere that it always ran the code at least once plus an 'empty loop' in order that it might eliminate it's own overhead from the timings, but adding the preload just made sure.


    Examine what is said, not who speaks.
    "Efficiency is intelligent laziness." -David Dunham
    "Think for yourself!" - Abigail