Skip to content

Commit

Permalink
Improve benchmarks table generator script (#24565)
Browse files Browse the repository at this point in the history
  • Loading branch information
waldyrious authored and StefanKarpinski committed Dec 7, 2017
1 parent 2cde54b commit e2e6fd2
Showing 1 changed file with 48 additions and 48 deletions.
96 changes: 48 additions & 48 deletions test/perf/micro/bin/table.pl
Original file line number Diff line number Diff line change
Expand Up @@ -12,72 +12,72 @@
our @benchmarks = qw(
iteration_pi_sum
recursion_fibonacci
recursion_quicksort
recursion_quicksort
parse_integers
print_to_file
matrix_statistics
matrix_multiply
userfunc_mandelbrot
);

our $c_ver = `gcc -v 2>&1 | grep "gcc version" | cut -f3 -d" "`;
our $julia_ver = `../../../julia -v | cut -f3 -d" "`;
our $fortran_ver = `gfortran -v 2>&1 | grep "gcc version" | cut -f3 -d" "`;
our $python_ver = `python3 -V 2>&1 | cut -f2 -d" "`;
our $matlab_ver = `matlab -nodisplay -nojvm -nosplash -r "version -release, quit" | tail -n 3 | head -n 1`;
our $R_ver = `R --version | grep "R version" | cut -f3 -d" "`;
our $octave_ver = `octave -v | grep version | cut -f4 -d" "`;
our $go_ver = `go version | cut -f3 -d" "`;
#our $lua_ver = `scilua -v 2>&1 | grep Shell | cut -f3 -d" " | cut -f1 -d,`;
our $c_ver = chomp(`gcc -v 2>&1 | grep "gcc version" | cut -f3 -d" "`);
our $julia_ver = chomp(`../../../julia -v | cut -f3 -d" "`);
our $fortran_ver = chomp(`gfortran -v 2>&1 | grep "gcc version" | cut -f3 -d" "`);
our $python_ver = chomp(`python3 -V 2>&1 | cut -f2 -d" "`);
our $matlab_ver = chomp(`matlab -nodisplay -nojvm -nosplash -r "version -release, quit" | tail -n 3 | head -n 1`);
our $R_ver = chomp(`R --version | grep "R version" | cut -f3 -d" "`);
our $octave_ver = chomp(`octave -v | grep version | cut -f4 -d" "`);
our $go_ver = chomp(`go version | cut -f3 -d" "`);
#our $lua_ver = chomp(`scilua -v 2>&1 | grep Shell | cut -f3 -d" " | cut -f1 -d,`);
our $lua_ver = "scilua v1.0.0-b12"; # scilua has no run-time versioninfo function
our $javascript_ver = `nodejs -e "console.log(process.versions.v8)"`;
our $mathematica_ver = `echo quit | math -version | head -n 1 | cut -f2 -d" "`;
#our $stata_ver = `stata -q -b version && grep version stata.log | cut -f2 -d" " && rm stata.log`;
our $java_ver = `java -version 2>&1 |grep "version" | cut -f 3 -d " " | cut -c 2-9`;
our $javascript_ver = chomp(`nodejs -e "console.log(process.versions.v8)"`);
our $mathematica_ver = chomp(`echo quit | math -version | head -n 1 | cut -f2 -d" "`);
#our $stata_ver = chomp(`stata -q -b version && grep version stata.log | cut -f2 -d" " && rm stata.log`);
our $java_ver = chomp(`java -version 2>&1 |grep "version" | cut -f3 -d " " | cut -c 2-9`);

our %systems = (
"c" => ["C" , "gcc $c_ver" ],
"julia" => ["Julia" , $julia_ver ],
"lua" => ["LuaJIT" , "$lua_ver" ],
"fortran" => ["Fortran" , "gcc $fortran_ver" ],
"java" => ["Java" , $java_ver ],
"javascript" => ["JavaScript" , "V8 $javascript_ver" ],
"matlab" => ["Matlab" , "R$matlab_ver" ],
"python" => ["Python" , $python_ver ],
"mathematica"=> ["Mathe-matica" , $mathematica_ver ],
"r" => ["R" , $R_ver ],
"octave" => ["Octave" , $octave_ver ],
"go" => ["Go" , $go_ver ],
# "stata" => ["Stata" , $stata_ver ],
"c" => ["C" , "gcc $c_ver" ],
"julia" => ["Julia" , $julia_ver ],
"lua" => ["LuaJIT" , "$lua_ver" ],
"fortran" => ["Fortran" , "gcc $fortran_ver" ],
"java" => ["Java" , $java_ver ],
"javascript" => ["JavaScript" , "V8 $javascript_ver" ],
"matlab" => ["Matlab" , "R$matlab_ver" ],
"python" => ["Python" , $python_ver ],
"mathematica"=> ["Mathe­matica" , $mathematica_ver ],
"r" => ["R" , $R_ver ],
"octave" => ["Octave" , $octave_ver ],
"go" => ["Go" , $go_ver ],
# "stata" => ["Stata" , $stata_ver ],
);

our @systems = qw(c julia lua fortran go java javascript mathematica python matlab r octave);
#our @systems = qw(lua);

print qq[<!-- Table generated by the Perl script test/perf/micro/bin/table.pl in the main julia repository -->\n];
print qq[<table class="benchmarks">\n];
print qq[<colgroup>\n];
print qq[<col class="name">\n];
printf qq[<col class="relative" span="%d">\n], scalar(@systems);
print qq[</colgroup>\n];
print qq[<thead>\n];
print qq[<tr>];
print qq[<td></td>];
print qq[<th class="system">$systems{$_}[0]</th>] for @systems;
print qq[</tr>\n];
print qq[<tr>];
print qq[<td></td>];
print qq[<td class="version">$systems{$_}[1]</td>] for @systems;
print qq[</tr>\n];
print qq[</thead>\n];
print qq[<tbody>\n];
print qq[\t<colgroup>\n];
print qq[\t\t<col class="name">\n];
printf qq[\t\t<col class="relative" span="%d">\n], scalar(@systems);
print qq[\t</colgroup>\n];
print qq[\t<thead>\n];
print qq[\t\t<tr>\n];
print qq[\t\t\t<th></th>\n];
print qq[\t\t\t<th class="system">$systems{$_}[0]</th>\n] for @systems;
print qq[\t\t</tr>\n];
print qq[\t\t<tr>\n];
print qq[\t\t\t<td></td>\n];
print qq[\t\t\t<td class="version">$systems{$_}[1]</td>\n] for @systems;
print qq[\t\t</tr>\n];
print qq[\t</thead>\n];
print qq[\t<tbody>\n];

for my $benchmark (@benchmarks) {
print qq[<tr>];
print qq[<th>$benchmark</th>];
print qq[\t\t<tr>\n];
print qq[\t\t\t<th>$benchmark</th>\n];
for my $system (@systems) {
printf qq[<td class="data">%.2f</td>], $_{$benchmark}{$system}/$_{$benchmark}{'c'};
printf qq[\t\t\t<td class="data">%.2f</td>\n], $_{$benchmark}{$system}/$_{$benchmark}{'c'};
}
print qq[</tr>\n];
print qq[\t\t</tr>\n];
}
print qq[</tbody>\n];
print qq[\t</tbody>\n];
print qq[</table>\n];

0 comments on commit e2e6fd2

Please sign in to comment.