Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

comment on

( [id://3333] : superdoc . print w/replies, xml ) Need Help??
(Sigh. I just can help myself, can I? Always with the advice... ;-)

Two suggestions for using Benchmark:

  1. If you're using long names for each test, pad the names to the same length with extra spaces on the left. Then your results are much easier to read and compare:
    Hash Exists Hit: 4 wallclock secs @ 1204819.28/s (n=10000 +00) Hash Defined Hit: 3 wallclock secs @ 2173913.04/s (n=10000 +00) Hash Exists Miss: 1 wallclock secs @ 1515151.52/s (n=10000 +00) Hash Defined Miss: 3 wallclock secs @ 1492537.31/s (n=10000 +00) Hash Assigned Miss Truth: 6 wallclock secs @ 1515151.52/s (n=10000 +00) Hash Assigned Hit Equality: 4 wallclock secs @ 1149425.29/s (n=10000 +00) Hash Assigned Hit Truth: 5 wallclock secs @ 970873.79/s (n=100000 +0) Hash Assigned Miss Equality: 6 wallclock secs @ 877192.98/s (n=100000 +0)
  2. Use cmpthese instead of timethese. That adds a handy comparison matrix at the end of your test results (though this suggestion works much better with shorter names):
    Rate HDH HAHE HAME HEH HAMT HDM HAHT HEM HDH 1111111/s -- -0% -4% -21% -24% -28% -30% -39% HAHE 1111111/s 0% -- -4% -21% -24% -28% -30% -39% HAME 1162791/s 5% 5% -- -17% -21% -24% -27% -36% HEH 1408451/s 27% 27% 21% -- -4% -8% -11% -23% HAMT 1470588/s 32% 32% 26% 4% -- -4% -7% -19% HDM 1538462/s 38% 38% 32% 9% 5% -- -3% -15% HAHT 1587302/s 43% 43% 37% 13% 8% 3% -- -13% HEM 1818182/s 64% 64% 56% 29% 24% 18% 15% --

In reply to Benchmark tips by TheDamian
in thread Making a match by Baz

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.