Consider @_ as being any variable with higher scope than any local my'd
variables found within the timethese code.
Now consider the case that I don't want to time 1,000,000 iterations of the
exact same case. Rather, I would like time 1,000,000 iterations of my code on
various cases.
In fact, for real world benchmarking (rather than simply using a benchmark to
profile a particular (simple) peice of code), you would probably want to run
your timethese using a statistical sample, or even real sample of test cases.
If timethese could somehow
magically (after all how is it going to know
which global variables you want to reset? isn't that what my is for anyway?)
reset the code to it's initial state (with zero time cost to boot!), then you
would not be able to do a simple benchmark such as:
(warning pseudo code)
srand; timethese(factorial(int rand*1000), 1 000 000);
Which would give you a sort of average performance of your code over certain
input ranges. However you could not do this benchmark if timethese magically
reset your initial state (because then you would pick the same random number
a million times).
Please pardon if I'm less than coherent, I wanted to make sure I posted
something today that was semi-useful, however I didn't get to manage it until
the wee hours of the morning.
Ciao,
Gryn
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.