Performance comparison with mix test results

I wrote a shell script to extract and rank the time it takes for tests to run. It is not a benchmark but it gives an indication of how well a solution performs. You can use it with different solutions and give a name to your solution as an argument to the shell script. Please feel free to play around with it.

#!/usr/bin/env bash

{
  printf "%s results from hardest tests:\n\n" "${1:-$(basename "$PWD")}";
  mix test --include pending |
  sed -En '/\* test / s/.*\r  \* test ([a-z ]*) \(([0-9]+).*/\2 ms: \1/p' |
  sort -nr |
  head -n4 |
  nl -n'ln' -s'. ' -w1;
  printf "\nTested at %s\n--------------------------------\n\n" "$(date +"%T on %F")";
} >> performance.txt
2 Likes