Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?

Re^3: Inconsistent Results with Benchmark

by ysth (Canon)
on Dec 08, 2014 at 07:52 UTC ( #1109523=note: print w/replies, xml ) Need Help??

in reply to Re^2: Inconsistent Results with Benchmark
in thread Inconsistent Results with Benchmark

Wouldn't just running each sub once before starting the benchmark do just as well?
A math joke: r = | |csc(θ)|+|sec(θ)| |-| |csc(θ)|-|sec(θ)| |
  • Comment on Re^3: Inconsistent Results with Benchmark

Replies are listed 'Best First'.
Re^4: Inconsistent Results with Benchmark
by flexvault (Monsignor) on Dec 08, 2014 at 15:31 UTC


    ++ for the good suggestion. And you can add a print statement for the *returned* results from each subroutine.

    I've seen examples of 'benchmark'ing 2 subroutines that don't produce the same results. Unless the results are the same, it doesn't make sense to compare the subroutines.


    "Well done is better than well said." - Benjamin Franklin

      I learned that the hard way the other day. Since I don't need "exactly-the-same" results from my tests, I now normalize them and do a character count to make sure they're not too far off from each other. For what I'm doing, and at this stage of my process, that's perfectly fine.

      I'm also finding, with the constant back and forth between code and running a benchmark, a want for some other features in the Benchmark module. I wrote some stuff that makes the process faster and easier. At the end of this project, I might clean it up and get it up here.


          Since I don't need "exactly-the-same" results from my tests...
        But you do!

        You use 'benchmark' in your testing environment to see which sequence of Perl declarations and statements produce the *best* result. You determine the meaning of *best*, but if the results are almost, you're missing the value of 'benchmark'.

        For example, you may be testing the use of an array or a hash within different subroutines, but the final result ( whatever you determine is the result ) must be the same. You may determine that the subroutines produce a file, and that file must be the exact same for all the different subroutines you 'benchmark'.

        Humans ( including programmers ) don't have the exactness of computers and that's why we need a great script like 'benchmark' to run our different scripts hundreds/thousands/millions of times to give us the best sequence.

        Almost isn't the same as equal!


        "Well done is better than well said." - Benjamin Franklin

Re^4: Inconsistent Results with Benchmark
by benwills (Sexton) on Dec 08, 2014 at 23:40 UTC

    No idea why I didn't think of that, but, based ons some tests, it looks like that works. For good measure, I'm loading it twice. And it keeps me from having to guess at how large of a string to create.

    Thank you.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1109523]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (2)
As of 2020-10-26 04:37 GMT
Find Nodes?
    Voting Booth?
    My favourite web site is:

    Results (250 votes). Check out past polls.