summaryrefslogtreecommitdiff
path: root/tools/format_benchmarks.awk
blob: 88dd7a3036f2c7916ce1ba5c6f3ce0022b7da207 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#!/bin/sh env awk
BEGIN {
    CONVFMT="%2.1f";
    print "| Sample                 |showdown  |commonmark|marked    |markdown-it|"
    print "|------------------------|---------:|---------:|---------:|----------:|"
}
{
        if (/samples\//) {
                sub(/samples\//, "");
                printf "|%-24s|", $7;
        } else if (/^showdown/) {
                sub(/,/, "");
                showdown = $4;
        } else if (/^commonmark/) {
                sub(/,/, "");
                commonmark = $4;
        } else if (/^marked/) {
                sub(/,/, "");
                marked = $4;
        } else if (/^markdown-it/) {
                sub(/,/, "");
                markdownit = $4;
                printf "%10s|%10s|%10s|%11s|\n",
                       (showdown / showdown),
                       (commonmark / showdown),
                       (marked / showdown),
                       (markdownit / showdown);
                markdownit = "";
                showdown = "";
                marked = "";
                commonmark = "";
        } else {
                next;
        }
}