Skip to content

Commit

Permalink
Benchmark script - as requested by Keradus
Browse files Browse the repository at this point in the history
Unix-only
  • Loading branch information
dericofilho authored and ucirello committed Jan 22, 2015
1 parent 59b10ab commit 8b0ba96
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions benchmark.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/bin/bash

command -v php >/dev/null 2>&1 || { echo "I require `php` but it's not available. Aborting." >&2; exit 255; }
command -v grep >/dev/null 2>&1 || { echo "I require `grep` but it's not available. Aborting." >&2; exit 255; }
command -v awk >/dev/null 2>&1 || { echo "I require `awk` but it's not available. Aborting." >&2; exit 255; }

if [ "" == "$1" ] || [ "" == "$2" ];
then
echo "Usage: bash benchmark.sh BRANCH1 BRANCH2 ...BRANCHN"
exit 1;
fi

for BRANCH in $@
do
git checkout $BRANCH &> /dev/null &&
git reset --hard &> /dev/null &&
echo -n $BRANCH
(for i in {1..10}; do php php-cs-fixer fix . ; done) | grep -i fixed | awk '
{
total += $5;
++count;
}
END {
print " mean:" (total/count) " total:" total " rounds:" count
}'
done

0 comments on commit 8b0ba96

Please sign in to comment.