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