This repository has been archived by the owner on Jun 6, 2021. It is now read-only.
forked from agentgt/template-engine-benchmarks
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild_graph.sh
95 lines (76 loc) · 3.28 KB
/
build_graph.sh
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
#!/bin/bash
#set -o errexit -o nounset
# errexit: stop executing if any errors occur, by default bash will just continue past any errors to run the next command
# nounset: stop executing if an unset variable is encountered, by default bash will use an empty string for the value of such variables.
set -o errexit
TARGET_DIR=benchmark-launcher/target
function buildGraphWithGnuPlot(){
local filename="$1"
local title="$2"
local format="$3"
local renderer="$4"
if [ -z "$renderer" ]; then
renderer="$format"
fi
gnuplot <<EOF
# Labels
set title '${title}'
set ylabel 'Template generation time (ns)'
set xlabel 'Template Engine'
set xtics nomirror rotate by -40
# Ranges
set autoscale
# Input
set datafile separator ','
# Output
set terminal $renderer enhanced font "Arial,11"
set output '$TARGET_DIR/${filename}.$format'
set grid
set key off
set boxwidth 0.9 relative
# box style
set style line 1 lc rgb '#1abc9c' lt 1
set style fill solid
# remove top and right borders
set style line 2 lc rgb '#808080' lt 1
set border 3 back ls 2
set tics nomirror
plot '$TARGET_DIR/${filename}.csv' every ::1 using 0:5:xticlabels(stringcolumn(1)) with boxes ls 1,\
'$TARGET_DIR/${filename}.csv' every ::1 using 0:(\$5):(sprintf("%d",\$5)) with labels
EOF
}
function buildGraph(){
buildGraphWithGnuPlot "$1" "$2" png pngcairo
buildGraphWithGnuPlot "$1" "$2" svg
}
function filterData() {
local templateName="$1"
local resultFile="jmh-result-benchmark-$templateName"
local otherEngines='Rythm\|JMustache\|Jmte\|Handlebars\|Xslt\|Jasper\|Thymeleaf\|Jamon\|Trimou'
head -1 $TARGET_DIR/jmh-result.csv > $TARGET_DIR/${resultFile}.csv
grep "$templateName" $TARGET_DIR/jmh-result.csv | grep 'JavaNative' | sed -r 's,^".+?\.([^."]+?)Benchmark[^"]*","\1",' >> $TARGET_DIR/${resultFile}.csv
grep "$templateName" $TARGET_DIR/jmh-result.csv | grep -v -e 'JavaNative\|'${otherEngines} | sed -r 's,^".+?\.([^."]+?)Benchmark[^"]*","\1",' >> $TARGET_DIR/${resultFile}.csv
buildGraph "$resultFile" "Java Template Engine Performance Comparison (template \"${templateName}\")"
head -1 $TARGET_DIR/jmh-result.csv > $TARGET_DIR/${resultFile}-others.csv
grep "$templateName" $TARGET_DIR/jmh-result.csv | grep 'JavaNative' | sed -r 's,^".+?\.([^."]+?)Benchmark[^"]*","\1",' >> $TARGET_DIR/${resultFile}-others.csv
grep "$templateName" $TARGET_DIR/jmh-result.csv | grep ${otherEngines} | sed -r 's,^".+?\.([^."]+?)Benchmark[^"]*","\1",' >> $TARGET_DIR/${resultFile}-others.csv
buildGraph "$resultFile-others" "Java Template Engine Performance Comparison (template \"${templateName}\") ... other engines"
}
filterData "stocks.html"
filterData "response.xml"
GIT_REV=$(git log -1 --format="Based on rev:%h (%ci)")
WIKI_PAGE="Home.md"
pushd "$TARGET_DIR"
rm -rf "template-engine-benchmarks.wiki"
git config --global push.default simple
git config --global user.name "Travis"
git config --global user.email "[email protected]"
git clone --quiet --branch=master https://[email protected]/jycr/template-engine-benchmarks.wiki.git
pushd "template-engine-benchmarks.wiki"
sed -r "s,^Based on rev:.+?[0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2}.+?$,$GIT_REV," -i "$WIKI_PAGE"
mv ../jmh*.svg ../jmh*.png graph/
git add "$WIKI_PAGE" graph/*
git commit -m "Update Graph"
git push -fq origin master
popd
popd