forked from commonmark/commonmark.js
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathformat_benchmarks.awk
More file actions
42 lines (42 loc) · 1.28 KB
/
format_benchmarks.awk
File metadata and controls
42 lines (42 loc) · 1.28 KB
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
36
37
38
39
40
41
42
#!/bin/sh env awk
BEGIN {
CONVFMT="%2.1f";
print "| Sample |showdown |commonmark|marked |markdown-it|"
print "|--------------------------|---------:|---------:|---------:|----------:|"
}
{
if (/^bench\/samples\//) {
sub(/bench\/samples\//, "");
printf "|%-26s|", "[" $0 "]";
samples[$0] = "bench/samples/" $0;
} else if (/^showdown/) {
sub(/,/, "");
showdown = $3;
} else if (/^commonmark/) {
sub(/,/, "");
commonmark = $3;
} else if (/^marked/) {
sub(/,/, "");
marked = $3;
} else if (/^markdown-it/) {
sub(/,/, "");
markdownit = $3;
printf "%10s|%10s|%10s|%11s|\n",
(showdown / showdown),
(commonmark / showdown),
(marked / showdown),
(markdownit / showdown);
markdownit = "";
showdown = "";
marked = "";
commonmark = "";
} else {
next;
}
}
END {
printf "\n";
for (sample in samples) {
printf "[%s]: %s\n", sample, samples[sample];
}
}