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

Re: [perl #127885] [patches] enhance bench.pl to test same perlunder different options/args

Thread Previous | Thread Next
From:
Dave Mitchell
Date:
June 21, 2017 10:30
Subject:
Re: [perl #127885] [patches] enhance bench.pl to test same perlunder different options/args
Message ID:
20170621103045.GA5763@iabyn.com
On Tue, Sep 27, 2016 at 04:01:34PM +0100, Dave Mitchell wrote:
[changes to Porting/bench.pl]
> I'm not entirely happy with this new syntax and implementation.
> 
> Firstly, the documentation doesn't make it clear what are perls and
> what are perl args, and to which perl they apply. Is it the intention
> that all non-perls following a perl (up to but not including the next
> perl) are args of the previous perl? i.e.
> 
>     perlA -perlA_arg1 -perlA_arg2    perlB -perlB_arg1 -perlB_arg2
> 
> Secondly it introduces a bug whereby a misspelled perl executable
> name is now just silently ignored: this
> 
>     $ Porting/bench.pl nosuchperl perl5240
> 
> quite happily benchmarks just perl5240 with no warnings.
> 
> Third, the determination of what is a perl executable and what is an arg
> seems a bit haphazard. It seems to be: if it starts with a dash, assume
> its an arg, else try and execute it, and if it doesn't execute ok, assume
> its an arg? I don't like this at all. I'd much prefer it to be
> deterministic based on the command line's syntax, although I'm not sure
> what syntax. Perhaps args to perl should be part of the same arg as the
> executable name, e.g.
> 
>     Porting/bench.pl  \
>         'perlA+foo -perlA_arg1 -perlA_arg2' \
>         'perlB+bar -perlB_arg1 -perlB_arg2'
> 
> although I guess that could run afoul of executable pathnames with spaces
> in them.


I've just pushed a branch with about 24 commits that fixes up bench.pl a
lot and adds a (reasonably) comprehensive test suite.

I decided to handle per-perl args and environment using --args and --env
switches following the perl, e.g.

    Porting/bench.pl  \
        'perlA --args='-perlA_arg1 -perlA_arg2' --env='FOO=A' \
        'perlB --args='-perlB_arg1 -perlB_arg2' --env='FOO=B' --env='BAR=B'

Here's the merge commit message:

commit 4c95ee9f298c2edfc1382d540ff89288790e78b6
Merge: fce4ebb b9248ec
Author:     David Mitchell <davem@iabyn.com>
AuthorDate: Wed Jun 21 11:29:01 2017 +0100
Commit:     David Mitchell <davem@iabyn.com>
CommitDate: Wed Jun 21 11:29:01 2017 +0100

    [MERGE] test and fix up Porting/bench.pl
    
    bench.pl didn't have  a proper test suite, and some command-line options
    had suffered from bit rot. For example, --bisect no longer worked.
    This branch adds such a test suite, and includes various fix ups and
    improvements. In particular:
    
    * Conceptually reorganise bench.pl into input, benchmark, output:
       1) read in zero or more previous runs;
       2) possibly do another run, and aggregate results with any reads;
       3) output the aggregate of (1) and (2) in various ways. There are three
          possible outputs: save raw data for later with --write, display in
          human-readable form with --show, and alter exit value with --bisect.
    
       bench.pl kind of did all that anyway, but with that model, I've made it
       allow --bisect with --show or --read for example. There's no reason
       why you can't do all three of: --write the results, --show the results,
       and alter the exit value with --bisect.
       Options like --norm, --compact etc are now conceptually sub-options of
       --show.
       The pod has been re-organised to reflect this.
    
    * add -autolabel option, which generates unique labels for those perls
      which haven't got one.
    
    * new syntax for per-perl args and environment:
        ./perl --args=..., --env=....
    
    * fix broken --bisect; it also now displays the field value on stdout.
    
    * Allow 1 only perl under --raw
    
    * better error checks
    
    * General code cleanup



-- 
"Procrastination grows to fill the available time"
    -- Mitchell's corollary to Parkinson's Law

Thread Previous | Thread Next


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