-
Notifications
You must be signed in to change notification settings - Fork 22
/
build.sh
167 lines (142 loc) · 5.6 KB
/
build.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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
#/bin/bash
CC=g++
#CC=clang++
function CompilePerformance()
{
rm -rf build
mkdir build
$CC -c -O3 -o build/jsoncpp_reader.o -Itest/performance/c++/jsoncpp/include test/performance/c++/jsoncpp/src/lib_json/json_reader.cpp -std=c++11;
$CC -c -O3 -o build/json_value.o -Itest/performance/c++/jsoncpp/include test/performance/c++/jsoncpp/src/lib_json/json_value.cpp -std=c++11;
$CC -c -O3 -o build/json_writer.o -Itest/performance/c++/jsoncpp/include test/performance/c++/jsoncpp/src/lib_json/json_writer.cpp -std=c++11;
$CC -c -O3 -o build/cjson.o -Itest/performance/c++/cJSON test/performance/c++/cJSON/cJSON.c -std=c++11;
$CC -c -O3 -o build/gason.o -Itest/performance/c++/gason/src test/performance/c++/gason/src/gason.cpp -std=c++11;
$CC -c -O3 -o build/parson.o -Itest/performance/c++/parson test/performance/c++/parson/parson.c;
$CC -o performance_test test/performance/c++/performance_test.cpp build/* -std=c++11 -O3 -g;
}
function PerformanceTestOne()
{
files=$3
for f in ${files[*]}; do
./performance_test $1 parse $f >> $2
./performance_test $1 stringify $f >> $2
./performance_test $1 all $f >> $2
echo -n .
done
}
function PerformanceNoNum()
{
output=nonum.txt
files=(nonum.json nonum1.json nonum2.json)
rm -rf $output
PerformanceTestOne zzzjson $output ${files[*]}
PerformanceTestOne rapidjson $output ${files[*]}
PerformanceTestOne rapidjsonfp $output ${files[*]}
PerformanceTestOne rapidjsonstr $output ${files[*]}
# PerformanceTestOne arduinojson $output ${files[*]}
PerformanceTestOne cjson $output ${files[*]}
PerformanceTestOne gason $output ${files[*]}
PerformanceTestOne picojson $output ${files[*]}
# PerformanceTestOne parson $output ${files[*]}
PerformanceTestOne jsoncpp $output ${files[*]}
PerformanceTestOne nlohmannjson $output ${files[*]}
PerformanceTestOne taocppjson $output ${files[*]}
PerformanceTestOne zzzjsonbeta $output ${files[*]}
}
function PerformanceNativeJSONBenchmark()
{
output=nativejsonbenchmark.txt
files=(canada.json citm_catalog.json twitter.json)
rm -rf $output
PerformanceTestOne zzzjson $output ${files[*]}
PerformanceTestOne rapidjson $output ${files[*]}
PerformanceTestOne rapidjsonfp $output ${files[*]}
PerformanceTestOne rapidjsonstr $output ${files[*]}
PerformanceTestOne arduinojson $output ${files[*]}
PerformanceTestOne cjson $output ${files[*]}
PerformanceTestOne gason $output ${files[*]}
PerformanceTestOne picojson $output ${files[*]}
PerformanceTestOne parson $output ${files[*]}
PerformanceTestOne jsoncpp $output ${files[*]}
PerformanceTestOne nlohmannjson $output ${files[*]}
PerformanceTestOne taocppjson $output ${files[*]}
PerformanceTestOne zzzjsonbeta $output ${files[*]}
}
function PerformanceTaoBao()
{
output=taobao.txt
files=(cart.json trade.json)
rm -rf $output
PerformanceTestOne zzzjson $output ${files[*]}
PerformanceTestOne rapidjson $output ${files[*]}
PerformanceTestOne rapidjsonfp $output ${files[*]}
PerformanceTestOne rapidjsonstr $output ${files[*]}
PerformanceTestOne arduinojson $output ${files[*]}
PerformanceTestOne cjson $output ${files[*]}
PerformanceTestOne gason $output ${files[*]}
PerformanceTestOne picojson $output ${files[*]}
PerformanceTestOne parson $output ${files[*]}
PerformanceTestOne jsoncpp $output ${files[*]}
PerformanceTestOne nlohmannjson $output ${files[*]}
PerformanceTestOne taocppjson $output ${files[*]}
PerformanceTestOne zzzjsonbeta $output ${files[*]}
}
function PerformanceNormal()
{
output=normal.txt
files=(canada.json citm_catalog.json twitter.json cart.json trade.json large-file.json)
rm -rf $output
PerformanceTestOne zzzjson $output ${files[*]}
PerformanceTestOne rapidjson $output ${files[*]}
PerformanceTestOne rapidjsonfp $output ${files[*]}
PerformanceTestOne rapidjsonstr $output ${files[*]}
PerformanceTestOne arduinojson $output ${files[*]}
PerformanceTestOne cjson $output ${files[*]}
PerformanceTestOne gason $output ${files[*]}
PerformanceTestOne picojson $output ${files[*]}
PerformanceTestOne parson $output ${files[*]}
PerformanceTestOne jsoncpp $output ${files[*]}
PerformanceTestOne nlohmannjson $output ${files[*]}
PerformanceTestOne taocppjson $output ${files[*]}
PerformanceTestOne zzzjsonbeta $output ${files[*]}
}
function PerformanceRandom()
{
./performance_test randomshortjsontest > randomshortjsontest.txt
echo -n .
./performance_test randomlongjsontest > randomlongjsontest.txt
}
function PerformanceTest
{
echo ' '
echo PerformanceNoNum
PerformanceNoNum
echo ' '
echo PerformanceNativeJSONBenchmark
PerformanceNativeJSONBenchmark
echo ' '
echo PerformanceTaoBao
PerformanceTaoBao
echo ' '
echo PerformanceNormal
PerformanceNormal
echo ' '
echo PerformanceRandom
PerformanceRandom
}
if [ "$1" == "function_test" ];then
rm -rf function_test
$CC -o function_test test/function/function_test.cpp --std=c++11 -g -O0
elif [ "$1" == "conformance_test" ];then
rm -rf conformance_test
$CC -o conformance_test test/conformance/conformance_test.cpp --std=c++11 -g -O0
elif [ "$1" == "performance_test" ];then
CompilePerformance
elif [ "$1" == "all" ];then
$CC -o function_test test/function/function_test.cpp --std=c++11 -g -O3
$CC -o conformance_test test/conformance/conformance_test.cpp --std=c++11 -g -O3
CompilePerformance
./function_test
./conformance_test
PerformanceTest
./performance_test statistic
fi