-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathsummarize.py
More file actions
65 lines (54 loc) · 1.48 KB
/
summarize.py
File metadata and controls
65 lines (54 loc) · 1.48 KB
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
import json
import os
import csv
import sys
def _read_reports(engine: str):
root = {
"arrow2": "target/criterion/arrow2/",
"pyarrow": "benchmarks/runs",
"arrow": "target/criterion/arrow/",
}[engine]
result = []
for original_path, dirs, files in os.walk(root):
path = original_path.split(os.sep)
if path[-1] != "new":
continue
path = path[-4:-1]
task = path[0]
keys = path[1].split()
size = int(path[2])
with open(os.path.join(original_path, "estimates.json")) as f:
data = json.load(f)
ms = data["mean"]["point_estimate"] / 1000
result.append(
{
"engine": engine,
"task": task,
"type": keys[0],
"is_dict": "dict" in keys,
"multi_page": "multi" in keys,
"is_compressed": "snappy" in keys,
"size": size,
"time": ms,
}
)
return result
def print_csv_report():
writer = csv.writer(sys.stdout)
writer.writerow(
[
"Engine",
"Task",
"Type",
"Is dictionary",
"Is multi page",
"Is compressed",
"Size",
"Time",
]
)
for engine in ["arrow2", "pyarrow", "arrow"]:
result = _read_reports(engine)
for row in result:
writer.writerow(row.values())
print_csv_report()