Benchmark.Responders.Perlish Perlish responders suite for Benchmark

Version

use the source, young padawan!

Synopsis


new Benchmark(
  { // functions to be benchmarked ...
  },
  { // options ...
    responders: 'Perlish',
    // ... more options ...
  }
);

Examples

Run any Benchmark example, using Perlish responders suite. Output will look like the following:

Iterations limited sample output:

  Browser: Mozilla/5.0 Gecko/20070130 Firefox/2.0.0.1
  Timing 10000 iterations of clean, lazy, reverse...
    clean:   0.234s @  42735/s (n=10000, b=0ms, w=1ms, a=0.02ms)
     lazy:   0.255s @  39216/s (n=10000, b=0ms, w=1ms, a=0.03ms)
  reverse:   0.452s @  22124/s (n=10000, b=0ms, w=222ms, a=0.05ms)
             Rate reverse  lazy clean
  reverse 22124/s      --  -44%  -48%
     lazy 39216/s     44%    --   -9%
    clean 42735/s     48%    9%    --
  Tests duration: 0.941 seconds.
  Total duration: 12.863 seconds.
  

Duration limited sample output:

  Browser: Mozilla/5.0 Gecko/20070130 Firefox/2.0.0.1
  Running clean, lazy, reverse for at least 1 seconds...
    clean:   1.000s @  30770/s (n=30770, b=0ms, w=232ms, a=0.03ms)
     lazy:   1.167s @  23798/s (n=27772, b=0ms, w=234ms, a=0.04ms)
  reverse:   1.000s @  32041/s (n=32041, b=0ms, w=224ms, a=0.03ms)
             Rate  lazy clean reverse
     lazy 23798/s    --  -23%    -26%
    clean 30770/s   23%    --     -4%
  reverse 32041/s   26%    4%      --
  Tests duration: 3.167 seconds.
  Total duration: 33.530 seconds.
  

Description

This is Benchmark's default responders suite, which generates an output similar to Perl's Benchmark.pm

Explaining the previous example:

First line describes the browser running the benchmark.

Second line gives a brief benchmark summary: what functions are to be run? for how long?

Next, there is a block summarizing each method timing results. There is one line per method, ordered alphabetically. Each such line contains:

  1. method name: clean
  2. total duration (seconds): 0.234s
  3. average running rate (per second): 42735/s
  4. number of method executions: n=10000
  5. best running time (milliseconds): b=0ms
  6. worst running time (milliseconds): w=232ms
  7. average running time (milliseconds): a=0.03ms

Next, there's the comparison block: it presents the relative performance of each method compared to all others. There is one line per method, ordered by the averate running rate. Each such line contains:

  1. method name: reverse
  2. average running rate (per second): 22124/s
  3. percentile comparison with method X: -44%
    Negative numbers mean: this method it's ABC% slower than method X
    Positive numbers mean: this method it's ABC% faster than method X

Finally, there's benchmark duration summary block:

  1. How long did all testing took? Tests duration: 0.941 seconds
  2. How long did all this procedure took? Total duration: 12.863 seconds

Dependencies

None.

Bugs and Limitations

No bugs have been reported.

See Also

Authors

Marius Feraru, <altblue@n0i.net>.

License and Copyright

© 2006-2007 Marius Feraru <altblue@n0i.net>. All rights reserved.

This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

Disclaimer of Warranty

Because this software is licensed free of charge, there is no warranty for the software, to the extent permitted by applicable law. Except when otherwise stated in writing the copyright holders and/or other parties provide the software "as is" without warranty of any kind, either expressed or implied, including, but not limited to, the implied warranties of merchantability and fitness for a particular purpose. The entire risk as to the quality and performance of the software is with you. should the software prove defective, you assume the cost of all necessary servicing, repair, or correction.

In no event unless required by applicable law or agreed to in writing will any copyright holder, or any other party who may modify and/or redistribute the software as permitted by the above license, be liable to you for damages, including any general, special, incidental, or consequential damages arising out of the use or inability to use the software (including but not limited to loss of data or data being rendered inaccurate or losses sustained by you or third parties or a failure of the software to operate with any other software), even if such holder or other party has been advised of the possibility of such damages.