Skip to content
This repository

Dependencies

  • perl5.10
  • any interepeter required for the solutions:

Running the current benchmark-er

compare_implementations.pl

compare_problem_number.pl

bench

bench [action] any number of languages or problems —opt=value —opt=value

problems are assumed to be a numeric string.
languages are known (via fs and config) thus any non-numeric string is checked on that list.
Anything leftover is concidered an option key with a value of 1 unless the string that starts with ‘—’ then we split on ‘=’ for key/value pairs, this is all assigned to the opts hash.

currently known actions are :

  • report (default)
  • json (encodes the data collected from all runs to JSON and then prints to STDOUT)
  • rawdata (Data::Dumper output)

currently known options are:

  • count (expected to be an int)
  • order (acceptable values are:)
    • interpreter
    • language
    • min
    • avg
    • max
    • file
    • problem_set
    • total
    • problem

EXAMPLES:

bench perl5 0 report (default) only perl5 solutions for problem 000
bench 0 --count=10 --order=language report (default) only perl5 solutions for problem 000 and order by the language
bench json 000 > all_000.json json output of all languages for problem 000 to the file all_000.json
bench rawdata perl5 rakudo ruby datadumper output of all problems solved for perl5 rakudo(perl6) and ruby.
bin/bench 0:2 1:1,3 2 perl5 --count=10 report output but only run the second solution for problem 000, the first and third for problem 001 and all solutions for problem 002 in perl5.

Output

bench report


bin/bench perl5 haskell 0 1 --count=10
                                                                                       min     max     avg    total
 haskell /usr/local/bin/runhaskell 000 /home/benh/git/euler_bench/haskell/000/01.hs  0.6753  0.8118  0.7282  7.2822
 haskell /usr/local/bin/runhaskell 001 /home/benh/git/euler_bench/haskell/001/01.hs  0.7718  0.9028  0.8108  8.1081
 haskell /usr/local/bin/runhaskell 001 /home/benh/git/euler_bench/haskell/001/02.hs  0.7845  1.0382  0.8623  8.6226
 haskell /usr/local/bin/runhaskell 001 /home/benh/git/euler_bench/haskell/001/03.hs  0.7706  0.9490  0.8127  8.1266
 haskell /usr/local/bin/runhaskell 001 /home/benh/git/euler_bench/haskell/001/04.hs  0.7641  0.9573  0.8286  8.2857
 haskell /usr/local/bin/runhaskell 001 /home/benh/git/euler_bench/haskell/001/05.hs  0.7357  0.9176  0.8042  8.0417
 perl5   /usr/bin/perl             000 /home/benh/git/euler_bench/perl5/000/01.pl    0.0184  0.0232  0.0199  0.1986
 perl5   /usr/bin/perl             000 /home/benh/git/euler_bench/perl5/000/02.pl    0.0079  0.0096  0.0087  0.0869
 perl5   /usr/bin/perl             001 /home/benh/git/euler_bench/perl5/001/01.pl    0.0308  0.0385  0.0330  0.3302
 perl5   /usr/bin/perl             001 /home/benh/git/euler_bench/perl5/001/02.pl    0.0191  0.0211  0.0201  0.2013
 perl5   /usr/bin/perl             001 /home/benh/git/euler_bench/perl5/001/03.pl    0.0186  0.0232  0.0199  0.1995

bench json


bin/bench json perl5 0 --count=2
[{"interpreter":"/usr/bin/perl","language":"perl5","min":0.0186939999694004655,"avg":0.0209359999862499535,"max":0.0229589999653398991,"file":"/home/benh/git/euler_bench/perl5/000/01.pl","problem_set":"perl5","total":0.041871999972499907,"problem":"000","times":[0.0186939999694004655,0.0229589999653398991]},{"interpreter":"/usr/bin/perl","language":"perl5","min":0.00922400003764778376,"avg":0.00972550001461058855,"max":0.0100439999951049685,"file":"/home/benh/git/euler_bench/perl5/000/02.pl","problem_set":"perl5","total":0.0194510000292211771,"problem":"000","times":[0.00922400003764778376,0.0100439999951049685]}]

bench rawdata


bin/bench rawdata perl5 0 --count=2
$VAR1 = [
          {
            'interpreter' => '/usr/bin/perl',
            'language' => 'perl5',
            'min' => '0.0182639999547973275',
            'avg' => '0.0186570000369101763',
            'max' => '0.0188300000736489892',
            'file' => '/home/benh/git/euler_bench/perl5/000/01.pl',
            'problem_set' => 'perl5',
            'total' => '0.0373140000738203526',
            'problem' => '000',
            'times' => [
                         '0.0182639999547973275',
                         '0.0188300000736489892'
                       ]
          },
          {
            'interpreter' => '/usr/bin/perl',
            'language' => 'perl5',
            'min' => '0.00781099998857825994',
            'avg' => '0.0079039999982342124',
            'max' => '0.00782200007233768702',
            'file' => '/home/benh/git/euler_bench/perl5/000/02.pl',
            'problem_set' => 'perl5',
            'total' => '0.0158079999964684248',
            'problem' => '000',
            'times' => [
                         '0.00781099998857825994',
                         '0.00782200007233768702'
                       ]
          }
        ];

Something went wrong with that request. Please try again.