-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathshow_results.py
428 lines (379 loc) · 14.7 KB
/
show_results.py
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
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
import json
import os.path
TEXT="TEXT"
BINARY="BINARY"
BINARY_EXECUTE_ONLY="BINARY EXECUTE ONLY"
BINARY_PIPELINE="BINARY PIPELINE"
BULK="BULK"
REWRITE="REWRITE"
DO_1 = "do 1"
DO_1000 = "do 1000 parameters"
BATCH_100 = "batch 100 insert of 100 chars"
SELECT_1 = "select 1"
SELECT_100 = "Select 100 int cols"
SELECT_1000_ROWS = "select 1000 rows"
def around(x):
if (x > 1000):
return int(x)
return round(x, 1)
res = { }
# JAVA results
if(os.path.exists('./bench_results_java.json')):
f = open('bench_results_java.json', 'r')
data = json.load(f)
for i in data:
val = around(i['primaryMetric']['score'])
bench = ""
type = TEXT
if ".Do_1." in i['benchmark']:
bench = DO_1
elif ".Do_1000_params.text" in i['benchmark']:
bench = DO_1000
elif ".Do_1000_params.binary" in i['benchmark']:
bench = DO_1000
type = BINARY_EXECUTE_ONLY
elif ".Insert_batch.binary" in i['benchmark']:
bench = BATCH_100
type = BINARY_EXECUTE_ONLY
if (i['params']['driver'] == "mariadb"):
type = BULK
elif ".Insert_batch.rewrite" in i['benchmark']:
bench = BATCH_100
type = REWRITE
if (i['params']['driver'] == "mariadb"):
type = TEXT
elif ".Insert_batch.text" in i['benchmark']:
bench = BATCH_100
type = TEXT
elif ".Select_1." in i['benchmark']:
bench = SELECT_1
elif ".Select_100_cols.text" in i['benchmark']:
bench = SELECT_100
type = TEXT
elif i['benchmark'].endswith(".Select_100_cols.binary"):
bench = SELECT_100
type = BINARY_EXECUTE_ONLY
elif ".Select_100_cols.binaryNoCache" in i['benchmark']:
bench = SELECT_100
type = BINARY_PIPELINE
if (i['params']['driver'] == "mysql"):
continue
elif ".Select_100_cols.binaryNoPipeline" in i['benchmark']:
bench = SELECT_100
type = BINARY
elif ".Select_1000_Rows.text" in i['benchmark']:
bench = SELECT_1000_ROWS
type = TEXT
elif ".Select_1000_Rows.binary" in i['benchmark']:
bench = SELECT_1000_ROWS
type = BINARY_EXECUTE_ONLY
if not bench in res:
res[bench] = {}
if not type in res[bench]:
res[bench][type] = {}
res[bench][type]['java ' + i['params']['driver']] = val
f.close()
# DOTNET results
if(os.path.exists('./bench_results_dotnet.json')):
f = open('bench_results_dotnet.json', 'r')
data = json.load(f)['Benchmarks']
for i in data:
if (i['Statistics'] != None and "Mean" in i['Statistics']):
val = around(1000000000 / i['Statistics']['Mean'])
bench = ""
type = TEXT
driver = "community"
if ("MySql.Data" in i['Parameters']):
driver = "mysql"
if "ExecuteDo1" == i['Method']:
bench = DO_1
elif "ExecuteDo1000Param" in i['Method']:
bench = DO_1000
elif "ExecuteDo1000PrepareParam" in i['Method']:
bench = DO_1000
type = BINARY_EXECUTE_ONLY
elif "Select1000rowsText" == i['Method']:
bench = SELECT_1000_ROWS
type = TEXT
elif "Select1000rowsBinary" == i['Method']:
bench = SELECT_1000_ROWS
type = BINARY_EXECUTE_ONLY
elif "Select100ColText" in i['Method']:
bench = SELECT_100
type = TEXT
elif "Select100ColBinary" in i['Method']:
bench = SELECT_100
type = BINARY_EXECUTE_ONLY
elif ".Insert_batch.binary" in i['Method']:
bench = BATCH_100
type = BINARY_EXECUTE_ONLY
elif ".Insert_batch.rewrite" in i['Method']:
bench = BATCH_100
type = REWRITE
elif ".Insert_batch.text" in i['Method']:
bench = BATCH_100
type = TEXT
elif "Select1" in i['Method']:
bench = SELECT_1
elif ".Select_100_cols.binaryNoCache" in i['Method']:
bench = SELECT_100
type = BINARY_PIPELINE
elif ".Select_100_cols.binaryNoPipeline" in i['Method']:
bench = SELECT_100
type = BINARY
if not bench in res:
res[bench] = {}
if not type in res[bench]:
res[bench][type] = {}
res[bench][type]['.net ' + driver] = val
f.close()
def parseBenchResults(file, connType, language):
if(os.path.exists(file)):
f = open(file, 'r')
data = json.load(f)['benchmarks']
for i in data:
bench = ""
type = TEXT
if os.getenv("TEST_DB_THREAD", default="1") + "_mean" in i['name']:
val = around(float(i['nb operations per second']))
if "DO 1/" in i['name']:
bench = DO_1
elif "insert batch using bulk/" in i['name']:
bench = BATCH_100
type = BULK
elif "insert batch client rewrite/" in i['name']:
bench = BATCH_100
type = REWRITE
elif "insert batch looping execute/" in i['name']:
bench = BATCH_100
type = BINARY
elif "SELECT 1/" in i['name']:
bench = SELECT_1
elif "SELECT 100 int cols/" in i['name']:
bench = SELECT_100
type = TEXT
elif "SELECT 100 int cols - BINARY execute only/" in i['name']:
bench = SELECT_100
type = BINARY_EXECUTE_ONLY
elif "SELECT 100 int cols - BINARY pipeline prepare+execute+close/" in i['name']:
bench = SELECT_100
type = BINARY_PIPELINE
elif "SELECT 100 int cols - BINARY prepare+execute+close/" in i['name']:
bench = SELECT_100
type = BINARY
elif "SELECT 1000 rows (int + char(32))/" in i['name']:
bench = SELECT_1000_ROWS
type = TEXT
# elif "DO 1000 params/" in i['name']:
# # if not (language == "c"):
# bench = DO_1000
# type = TEXT
# # if (connType == "mysql"):
# # type = BINARY
else:
print("bench not recognized : " + i['name'])
if bench != "":
if not bench in res:
res[bench] = {}
if not type in res[bench]:
res[bench][type] = {}
res[bench][type][language + ' ' + connType] = val
f.close()
# C mariadb results
parseBenchResults("./bench_results_c_mysql.json", "mysql", "c")
parseBenchResults("./bench_results_c_mariadb.json", "mariadb", "c")
# C++ mariadb results
parseBenchResults("./bench_results_cpp_mysql.json", "mysql", "c++")
parseBenchResults("./bench_results_cpp_mariadb.json", "mariadb", "c++")
if(os.path.exists('./bench_results_nodejs.json')):
f = open('bench_results_nodejs.json', 'r')
data = json.load(f)
for benchType in data:
for curRes in data[benchType]:
val = around(curRes['iteration'])
bench = ""
type = TEXT
if benchType == "do 1":
bench = DO_1
elif benchType == "do 1000 parameter":
bench = DO_1000
elif benchType == "do 1000 parameter - BINARY":
bench = DO_1000
type = BINARY_EXECUTE_ONLY
elif benchType.startswith("100 * insert 100 characters using batch method"):
bench = BATCH_100
type = TEXT
if (curRes['name'] == "mariadb"):
type = BULK
elif benchType == 'select 1':
bench = SELECT_1
elif benchType == 'select 100 int/varchar(32)':
bench = SELECT_100
type = TEXT
elif benchType == 'select 100 int/varchar(32) - BINARY':
bench = SELECT_100
type = BINARY_EXECUTE_ONLY
elif benchType == "select 1000 rows":
bench = SELECT_1000_ROWS
type = TEXT
elif benchType == "select 1000 rows - BINARY":
bench = SELECT_1000_ROWS
type = BINARY_EXECUTE_ONLY
else:
print("bench not recognized : " + benchType)
if bench != '':
if not bench in res:
res[bench] = {}
if not type in res[bench]:
res[bench][type] = {}
res[bench][type]['node ' + curRes['name']] = val
f.close()
# RUST results
def parseRustRes(path, type, bench):
if(os.path.exists(f"./scripts/rust/target/criterion/bench/{path}/base/estimates.json")):
f = open(f"scripts/rust/target/criterion/bench/{path}/base/estimates.json", 'r')
data = json.load(f)
val = around(1000000000 / data['mean']['point_estimate'])
if not bench in res:
res[bench] = {}
if not type in res[bench]:
res[bench][type] = {}
res[bench][type]['rust sync'] = val
f.close()
parseRustRes("do 1", TEXT, DO_1)
parseRustRes("do 1000 param", BINARY_EXECUTE_ONLY, DO_1000)
parseRustRes("select 1", TEXT, SELECT_1)
parseRustRes("select 1000 rows", TEXT, SELECT_1000_ROWS)
parseRustRes("select 1000 rows binary", BINARY_EXECUTE_ONLY, SELECT_1000_ROWS)
def parsePythonBenchResults(file, connType):
if(os.path.exists(file)):
f = open(file, 'r')
data = json.load(f)['benchmarks']
for i in data:
bench = ""
type = TEXT
val = 0
for tmpVal in i['runs'][1]['values']:
val += float(tmpVal)
length = len(i['runs'][1]['values'])
val = around(1 / (val / length))
if "DO 1" == i['metadata']['name']:
bench = DO_1
elif "BULK Insert" == i['metadata']['name']:
bench = BATCH_100
type = BULK
if (connType == "mysql"):
type = BINARY
elif "select 1" == i['metadata']['name']:
bench = SELECT_1
elif "select_100_cols" == i['metadata']['name']:
bench = SELECT_100
type = TEXT
elif "select_1000_rows" == i['metadata']['name']:
bench = SELECT_1000_ROWS
type = TEXT
elif "select 1000 rows - BINARY" == i['metadata']['name']:
bench = SELECT_1000_ROWS
type = BINARY_EXECUTE_ONLY
elif "select_100_cols_execute" == i['metadata']['name']:
bench = SELECT_100
type = BINARY_EXECUTE_ONLY
elif "DO 1000 params" == i['metadata']['name']:
bench = DO_1000
type = BINARY_EXECUTE_ONLY
else:
print("bench not recognized : " + i['metadata']['name'])
if bench != "":
if not bench in res:
res[bench] = {}
if not type in res[bench]:
res[bench][type] = {}
res[bench][type]['python ' + connType] = val
f.close()
parsePythonBenchResults("bench_results_python_mariadb_results.json", "mariadb")
parsePythonBenchResults("bench_results_python_mysql_results.json", "mysql")
connectorTypes = ()
for bench in res:
for type in res[bench]:
for connType in res[bench][type]:
if not connType in connectorTypes:
connectorTypes = connectorTypes + (connType,)
header1 = "{:53} |".format("")
for connectorType in connectorTypes:
header1 = header1 + "{:14}|".format("".ljust(14,"-"))
print(header1)
header = "{:53} |".format("")
for connectorType in connectorTypes:
v = connectorType
if (len(v) > 13):
v = v[0:12] + "."
header = header + " {:13}|".format(v)
print(header)
header1 = "{:54}|".format("".ljust(54,"-"))
for connectorType in connectorTypes:
header1 = header1 + "{:14}|".format("".ljust(14,"-"))
print(header1)
form = "{:30} - {:20} |"
for bench in res:
for type in res[bench]:
maxVal = 0
for connectorType in res[bench][type]:
if (res[bench][type][connectorType] > maxVal):
maxVal = res[bench][type][connectorType]
line = "{:30} - {:20} |".format(bench, type)
for connectorType in connectorTypes:
if (not connectorType in res[bench][type]):
line = line + "{:6.0} | {:4.0} |".format("", "")
else:
val = res[bench][type][connectorType]
line = line + "{:6.0f} | {:4.0%} |".format(val, val / maxVal)
print(line)
print(header1)
result2 = {}
for bench in res:
for type in res[bench]:
for connectorType in connectorTypes:
if (connectorType in res[bench][type]):
val = res[bench][type][connectorType]
if not bench in result2:
result2[bench] = {}
if not connectorType in result2[bench]:
result2[bench][connectorType] = val
else:
currVal = result2[bench][connectorType]
if (currVal < val):
result2[bench][connectorType] = val
print("")
print("")
print("agreggate results:")
print("")
header1 = "{:30} |".format("")
for connectorType in connectorTypes:
header1 = header1 + "{:14}|".format("".ljust(14,"-"))
print(header1)
header = "{:30} |".format("")
for connectorType in connectorTypes:
v = connectorType
if (len(v) > 13):
v = v[0:12] + "."
header = header + " {:13}|".format(v)
print(header)
header1 = "{:31}|".format("".ljust(31,"-"))
for connectorType in connectorTypes:
header1 = header1 + "{:14}|".format("".ljust(14,"-"))
print(header1)
form = "{:30} |"
for bench in result2:
maxVal = 0
for connectorType in result2[bench]:
if (result2[bench][connectorType] > maxVal):
maxVal = result2[bench][connectorType]
line = "{:30} |".format(bench)
for connectorType in connectorTypes:
if (not connectorType in result2[bench]):
line = line + "{:6.0} | {:4.0} |".format("", "")
else:
val = result2[bench][connectorType]
line = line + "{:6.0f} | {:4.0%} |".format(val, val / maxVal)
print(line)
print(header1)