This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
[MERGE] various bench.pl enhancements and fixes
authorDavid Mitchell <davem@iabyn.com>
Mon, 23 Oct 2017 11:57:57 +0000 (12:57 +0100)
committerDavid Mitchell <davem@iabyn.com>
Mon, 23 Oct 2017 11:57:57 +0000 (12:57 +0100)
Various enhancements and fixups to bench.pl. The most notable ones are:

* Add 'compile' benchmark field

    If a benchmark has this flag set, measure the compile time of the
    construct rather than its execution time, by wrapping the code in

        eval q{ sub { ... } }

* Add 'pre' and 'post' benchmark fields

    These allow actions to be performed each time round the loop, just before
    and after the benchmarked code, but without contributing to the timings.

    For example to benchmark appending to a string, you need to reset the
    string to a known state before each iteration, otherwise the string gets
    bigger and bigger with each iteration:

        code => '$s = ""; $s .= "foo"',

    but now you're measuring both the concat and an assign. To measure just
    the concat, you can now do:

        pre  => '$s = ""',
        code => '$s .= "foo"',

    Note the contrast with 'setup', which is only executed once, outside the
    loop.

* Make 'desc' default to 'code'

    Any entries in the benchmarks file which don't have a 'desc' description
    field will have the description set to the string for 'code'

* Allow negative column indices

    e.g. --norm=-2 will make the second-to-rightmost column the 100% one

* Miscellaneous:

     Make -v an alias for --verbose

     --compact: display description too

     Add checks for bad benchmark files

     Display large values as 'Inf'

     Allow variable-width data columns

     --autolabel: avoid degenerate cases

     Fix race condition in test

     List the valid perls as part of an 'unrecognised perl' error message


Trivial merge