Skip to content

Commit

Permalink
#19 insert into readme
Browse files Browse the repository at this point in the history
  • Loading branch information
yegor256 committed Apr 22, 2023
1 parent 58fbce6 commit df4ee21
Showing 1 changed file with 29 additions and 10 deletions.
39 changes: 29 additions & 10 deletions rebuild_benchmark.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,30 +19,49 @@ for capacity in ${capacities}; do
done

{
echo -n '| | '
echo -n '| |'
for capacity in ${capacities}; do
echo -n "${capacity} | "
echo -n " ${capacity} |"
done
echo ''
echo -n '| --- | '
echo -n '| --- |'
for capacity in ${capacities}; do
echo -n "--- | "
echo -n " --- |"
done
echo ''
maps=$(cut -f 1 tmp/2.out)
for map in ${maps}; do
if [ "${map}" -eq "micromap::Map" ]; then
break
if [ "${map}" == "micromap::Map" ]; then
continue;
fi
echo -n "| \`${map}\` | "
echo -n "| \`${map}\` |"
for capacity in ${capacities}; do
our=$(grep "micromap::Map" "tmp/${capacity}.out" | cut -f 2)
if [ "${our}" -eq "0" ]; then
our=1
fi
their=$(grep "${map}" "tmp/${capacity}.out" | cut -f 2)
perl -e "printf(\"%.02f | \", ${their} / ${our});"
perl -e "printf(\" %.02f |\", ${their} / ${our});"
done
echo ''
done
} > tmp/table.md

perl -e

perl -e '
my $readme;
my $file = "README.md";
open(my $r, "<", $file);
{ local $/; $readme = <$r>; }
close($r);
my $sep = "<!-- benchmark -->";
my @p = split(/\Q$sep\E/, $readme);
my $table = "tmp/table.md";
open(my $t, "<", $table);
{ local $/; $table = <$t>; }
close($t);
$p[1] = "\n\n" . $table . "\n\n";
my $new = join($sep, @p);
open(my $w, ">", $file);
print $w join($sep, @p);
close($w);
'

0 comments on commit df4ee21

Please sign in to comment.