#! /usr/bin/perl -w use autodie; use strict; our %MAP = ("c++-map" => 'GNU \textsf{libstdc++} \textsf{std::map}', "c++-uomap" => 'GNU \textsf{libstdc++} \textsf{std::unordered\_map}', "golang" => 'Golang \textsf{map}', "libavl-avl" => 'GNU \textsf{libavl} plain AVL trees', "libavl-pavl" => 'GNU \textsf{libavl} AVL trees, parent pointers', "libavl-rtavl" => 'GNU \textsf{libavl} AVL trees, right threaded', "libavl-tavl" => 'GNU \textsf{libavl} AVL trees, threaded', "libavl-rb" => 'GNU \textsf{libavl} plain red-black trees', "libavl-prb" => 'GNU \textsf{libavl} red-black trees, parent pointers', "libavl-rtrb" => 'GNU \textsf{libavl} red-black trees, right threaded', "libavl-trb" => 'GNU \textsf{libavl} red-black trees, threaded', "lisp-ccl" => 'Common Lisp (Clozure CL)', "lisp-clisp" => 'Common Lisp (GNU CLisp)', "lisp-cmucl" => 'Common Lisp (CMU CL)', "lisp-ecl" => 'Common Lisp (ECL)', "lisp-sbcl" => 'Common Lisp (SBCL)', "mLib-sym" => 'mLib, \textsf{sym} hash table', "perl" => 'Perl hash', "python" => 'Python \textsf{dict}', "qptrie-qp-fanf" => 'Four-bit QP-trie, recursive \textsf{Tnextl}', "qptrie-qp-mdw" => 'Four-bit QP-trie, iterative \textsf{Tnextl}', "qptrie-qp-list" => 'Four-bit QP-trie, linked list', "qptrie-fn-fanf" => 'Five-bit QP-trie, recursive \textsf{Tnextl}', "qptrie-fn-mdw" => 'Five-bit QP-trie, iterative \textsf{Tnextl}', "qptrie-fn-list" => 'Five-bit QP-trie, linked list', "rust-btree" => 'Rust \textsf{std::collections::BTreeMap}', "rust-hash" => 'Rust \textsf{std::collections::HashMap}', "sgt-tree234" => "Simon Tatham's 2-3-4 tree", "xyla-avl" => 'Xyla AVL tree', "xyla-rb" => 'Xyla red-black tree', "xyla-splay" => 'Xyla splay tree', "xyla-treap" => 'Xyla treap'); our @STAT = ("lower whisker", "lower quartile", "median", "average", "upper quartile", "upper whisker"); my @X; while (<>) { my ($impl, $data, $stat) = m{ ^ (\S+) ((?: \s+ [0-9.]+)*) \s* \; ((?: \s+ [0-9.]+){6}) \s* $ }x or die "bad line"; my @data = map { $_ + 0.0 } split ' ', $data; my @stat = map { $_ + 0.0 } split ' ', $stat; my ($wlo, undef, undef, undef, undef, $whi) = @stat; my @out = grep { $_ < $wlo || $_ > $whi } @data; push @X, [$impl, \@stat, \@out]; } print "\\begin{axis}\n"; printf " [ytick = {%s},\n", join(", ", 1 .. @X); print " yticklabels =\n"; for (my $i = 0; $i < @X; $i++) { my $x = $X[$i]; printf " %s{%s}%s\n", $i ? " " : "{", "\\textsf{$x->[0]}", $i == @X - 1 ? "}]" : ","; } for my $x (@X) { print " \\addplot+\n"; print " [boxplot prepared =\n"; my ($impl, $stat, $out) = $x->@*; STAT: for (my $j = 0; $j < @STAT; $j++) { next STAT unless defined $stat->[$j]; printf " %s%s = %.3f%s\n", $j ? " " : "{", $STAT[$j], $stat->[$j], $j == @STAT - 1 ? "}]" : ","; } printf " coordinates {%s};\n", join(" ", map { sprintf "(0, %.3f)", $_ } $out->@*); } print "\\end{axis}\n";