develooper Front page | perl.perl5.porters | Postings from October 2017

some bench.pl improvements

From:
Dave Mitchell
Date:
October 23, 2017 12:04
Subject:
some bench.pl improvements
Message ID:
20171023120343.GN3083@iabyn.com
I've just pushed the following, in case anyone's interested:

commit 7706bc5635d89ccfcf9bd9d3797a9c6f657934fd
Merge: 9c05dce ed7dc8b
Author:     David Mitchell <davem@iabyn.com>
AuthorDate: Mon Oct 23 12:57:57 2017 +0100
Commit:     David Mitchell <davem@iabyn.com>
CommitDate: Mon Oct 23 12:57:57 2017 +0100

[MERGE] various bench.pl enhancements and fixes

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

-- 
But Pity stayed his hand. "It's a pity I've run out of bullets",
he thought. -- "Bored of the Rings"



nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About