Skip to content

Instantly share code, notes, and snippets.

@oskopek
Last active August 29, 2015 14:26
Show Gist options
  • Save oskopek/ab01b23ee951d3362bcc to your computer and use it in GitHub Desktop.
Save oskopek/ab01b23ee951d3362bcc to your computer and use it in GitHub Desktop.
maven-checkstyle-plugin benchmark
#!/bin/bash
# Author: Ondrej Skopek (oskopek)
# Licensed under the MIT License (MIT): http://opensource.org/licenses/MIT
# Configuration
runs=5
newpom=newpom.xml
oldpom=oldpom.xml
internal_log=internal.log
cmd="mvn test -Dfull >> $internal_log 2>&1"
# Init
base="$(pwd)"
timecmd='/usr/bin/time -f "%e" -o "$tmpfile" '
tmpfile="$(mktemp)"
rm "$internal_log"
echo -e "Command: $cmd\n"
# Functions
run_old () {
cd "$base"
cp "$oldpom" pom.xml
eval "$timecmd $cmd"
cat "$tmpfile"
}
run_new () {
cd "$base"
cp "$newpom" pom.xml
eval "$timecmd $cmd"
cat "$tmpfile"
}
rm $internal_log
time_old=0
time_new=0
# Run old,new,...
for i in `seq 1 $runs`; do
this_run="$(run_old)"
time_old=$(echo "$time_old + $this_run" | bc)
echo "Old: $this_run"
this_run="$(run_new)"
time_new=$(echo "$time_new + $this_run" | bc)
echo "New: $this_run"
echo "--------------"
done
# Stats
echo -e "\nStatistics\n--------------"
echo "Total time old: $time_old"
echo "Total time new: $time_new"
time_old_avg=$(echo "scale=10; $time_old / $runs" | bc)
time_new_avg=$(echo "scale=10; $time_new / $runs" | bc)
echo "Time avg old: $time_old_avg"
echo "Time avg new: $time_new_avg"
diff=$(echo "scale=10; $time_new_avg - $time_old_avg" | bc)
echo "New average - old average: $diff"
per=$(echo "scale=10; (($time_new_avg / $time_old_avg) - 1 ) * 100" | bc)
echo "Slow down avg %: $per"
rm "$tmpfile"
Command: mvn clean install -Dfull >> internal.log 2>&1
Old: 260.67
New: 284.30
--------------
Old: 270.03
New: 279.55
--------------
Old: 266.61
New: 283.11
--------------
Old: 268.78
New: 281.16
--------------
Old: 266.03
New: 281.43
--------------
Statistics
--------------
Total time old: 1332.12
Total time new: 1409.55
Time avg old: 266.4240000000
Time avg new: 281.9100000000
New average - old average: 15.4860000000
Slow down avg %: 5.8125394100
Command: mvn clean test -Dfull >> internal.log 2>&1
Old: 189.74
New: 206.56
--------------
Old: 197.60
New: 214.62
--------------
Old: 185.08
New: 199.16
--------------
Old: 189.81
New: 200.90
--------------
Old: 185.95
New: 205.02
--------------
Statistics
--------------
Total time old: 948.18
Total time new: 1026.26
Time avg old: 189.6360000000
Time avg new: 205.2520000000
New average - old average: 15.6160000000
Slow down avg %: 8.2347233600
Command: mvn clean validate -Dfull >> internal.log 2>&1
Old: 5.35
New: 16.54
--------------
Old: 4.69
New: 18.06
--------------
Old: 5.08
New: 16.63
--------------
Old: 4.77
New: 16.61
--------------
Old: 4.92
New: 16.20
--------------
Statistics
--------------
Total time old: 24.81
Total time new: 84.04
Time avg old: 4.9620000000
Time avg new: 16.8080000000
New average - old average: 11.8460000000
Slow down avg %: 238.7343812900
Command: mvn install -Dfull >> internal.log 2>&1
Old: 246.37
New: 228.42
--------------
Old: 227.15
New: 221.73
--------------
Old: 225.91
New: 232.19
--------------
Old: 232.98
New: 235.26
--------------
Old: 230.33
New: 235.09
--------------
Statistics
--------------
Total time old: 1162.74
Total time new: 1152.69
Time avg old: 232.5480000000
Time avg new: 230.5380000000
New average - old average: -2.0100000000
Slow down avg %: -.8643376900
Command: mvn test >> internal.log 2>&1
Old: 150.49
New: 148.23
--------------
Old: 146.36
New: 148.76
--------------
Old: 149.94
New: 152.95
--------------
Old: 147.50
New: 148.92
--------------
Old: 151.21
New: 152.18
--------------
Statistics
--------------
Total time old: 745.50
Total time new: 751.04
Time avg old: 149.1000000000
Time avg new: 150.2080000000
New average - old average: 1.1080000000
Slow down avg %: .7431254100
Command: mvn test -Dfull >> internal.log 2>&1
Old: 179.27
New: 178.28
--------------
Old: 177.57
New: 174.49
--------------
Old: 174.64
New: 176.48
--------------
Old: 174.74
New: 178.58
--------------
Old: 181.12
New: 179.68
--------------
Statistics
--------------
Total time old: 887.34
Total time new: 887.51
Time avg old: 177.4680000000
Time avg new: 177.5020000000
New average - old average: .0340000000
Slow down avg %: .0191583800
Command: mvn validate -Dfull >> internal.log 2>&1
Old: 4.63
New: 5.70
--------------
Old: 4.56
New: 5.35
--------------
Old: 4.28
New: 5.22
--------------
Old: 4.57
New: 5.19
--------------
Old: 4.75
New: 5.50
--------------
Statistics
--------------
Total time old: 22.79
Total time new: 26.96
Time avg old: 4.5580000000
Time avg new: 5.3920000000
New average - old average: .8340000000
Slow down avg %: 18.2974989000
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment