This is very nice. I thought I'd add a few tips of my
own:
- Caching is the enemy of benchmarking. Make sure that
the code you're benchmarking doesn't do any caching of
the results. This is particularly important if you're
using code that other people have written (e.g., modules
from CPAN) as part of the code that you're benchmarking.
- Benchmarked code uses package global variables. This
is extremely important to note, because if you use
lexicals, your benchmark results will mean nothing,
because you'll most likely be using undefined values, or
values that you're not trying to test. So this goes along
with turnstep's recommendation to make sure that your
code works before you benchmark it: make sure that it works
*while* you're benchmarking it. Most of the time, I use
a loop count of 1 the first time I run a benchmark, then I
print out the values within the code reference (or string)
to make sure I've got everything right.
- Don't intermix eval'd strings with code references,
because, according to the Benchmark manpage, code
references will show slower execution times than
the equivalent eval'd strings.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
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, 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, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
Outside of code tags, you may need to use entities for some characters:
| |
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.
|
|