chiark / gitweb /
New version.
[runlisp] / bench / massage-benchmarks
1 #! /usr/bin/perl
2
3 use autodie;
4
5 my %LISP =
6   ("sbcl" => "SBCL",
7    "ccl" => "Clozure CL",
8    "ecl" => "ECL",
9    "clisp" => "GNU CLisp",
10    "cmucl" => "CMU CL",
11    "abcl" => "ABCL");
12 my %LABEL =
13   ("perl" => "Perl",
14    "python" => "Python",
15    "c.tcc" => "Tiny C",
16    "c.gcc" => "GCC",
17    "shell.dash" => "dash",
18    "shell.bash" => "GNU Bash",
19    "shell.zsh" => "Z Shell");
20
21 for my $l (keys %LISP) { $LABEL{"runlisp.$l"} = $LISP{$l}; }
22
23 {
24   my %d;
25
26   sub timing ($) {
27     my ($f) = @_;
28     return $d{$f} if exists $d{$f};
29     open my $fh, "<", "$f.bench";
30     (my $data = readline $fh) =~ s/^.* elapsed = ([0-9.]+)s.*$/$1/;
31     return $d{$f} = $data;
32   }
33 }
34
35 print <<EOF;
36 #> lisp
37 "Lisp system" "\\\\texttt{cl-launch}" "\\\\texttt{runlisp} (vanilla image)" "\\\\texttt{runlisp} (custom image)"
38 EOF
39 for my $l (sort keys %LISP) {
40   printf "\"%s\" %.4f %.4f %.4f\n",
41     $LISP{$l},
42     timing("cl-launch.$l"),
43     timing("runlisp-noimage.$l"),
44     timing("runlisp.$l");
45 }
46 print "\n\n";
47
48 print <<EOF;
49 #> interp
50 EOF
51 for my $i
52   ("runlisp.ccl", "runlisp.clisp", "runlisp.cmucl", "runlisp.sbcl",
53    "perl", "python",
54    "shell.dash", "shell.bash", "shell.zsh",
55    "c.tcc", "c.gcc")
56   { printf "\"%s\" %.4f\n", $LABEL{$i}, timing $i; }