in reply to Re: Benchmarking A DB-Intensive Script
in thread Benchmarking A DB-Intensive Script

Hi, I was thinking of something like this using Benchmark as well, but then how do I add the values across many (say 10k) iterations of the loop? I didn't see a way to do that with either Benchmark or Time::HiRes -- did I miss it?

  • Comment on Re^2: Benchmarking A DB-Intensive Script

Replies are listed 'Best First'.
Re^3: Benchmarking A DB-Intensive Script
by BrowserUk (Patriarch) on Mar 14, 2006 at 21:03 UTC

    Take a look at Benchmark::Timer. You can wrap a start/stop pairing around a piece of code and it accumulates the iterations and average the times taken for you. You can also run several different and overlapping pairs concurrently, which makes it easy to start with a course granularity and then home in onto those parts where you need finer granularity.

    It allows you to get finer granularity than one of the per subroutine profilers without resorting to the time expensive per line profilers.


    Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
    Lingua non convalesco, consenesco et abolesco. -- Rule 1 has a caveat! -- Who broke the cabal?
    "Science is about questioning the status quo. Questioning authority".
    In the absence of evidence, opinion is indistinguishable from prejudice.