Skip to content

Commit 6fa12a0

Browse files
committed
Automatize benchmark results
1 parent 40e9e84 commit 6fa12a0

File tree

2 files changed

+118
-2
lines changed

2 files changed

+118
-2
lines changed

.github/workflows/cpp.yml

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ jobs:
3838
sudo apt update
3939
sudo apt install -y cmake build-essential
4040
pip install conan
41-
- name: Setup Conan
41+
- name: Set up Conan dependencies
4242
run: |
4343
conan profile detect
4444
echo "
@@ -79,5 +79,15 @@ jobs:
7979
cd build
8080
make
8181
- name: Run benchmark
82+
run: ./cpp/build/bin/PSQLBench --benchmark_out=cpp/out.txt --benchmark_out_format=console
83+
- name: Prepare benchmark results
8284
run: |
83-
./cpp/build/bin/PSQLBench
85+
cd cpp
86+
python3 out.py
87+
- name: Save benchmark results
88+
uses: actions/upload-artifact@v3
89+
with:
90+
name: Benchmark results
91+
path: |
92+
cpp/Bench1.png
93+
cpp/Bench2.png

cpp/out.py

Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
import re
2+
import matplotlib.pyplot as plt
3+
import numpy as np
4+
5+
data = open('cmake-build-release/out.txt').read()
6+
7+
patterns = [
8+
r"BM_(PSQL)/\w+\/?\w+?/(\w+)/\d+/min_warmup_time:20\.000\s+(\d+)\sns\s+\d+\sns\s+\d+",
9+
r"BM_(Doublets)/(\w+)/\w+\/?\w+?/(\w+)/\d+/min_warmup_time:20\.000\s+(\d+)\sns\s+\d+\sns\s+\d+",
10+
]
11+
12+
PSQL_Transaction = []
13+
PSQL_NonTransaction = []
14+
Doublets_United_Volatile = []
15+
Doublets_United_NonVolatile = []
16+
Doublets_Split_Volatile = []
17+
Doublets_Split_NonVolatile = []
18+
19+
for pattern in patterns:
20+
matches = re.findall(pattern, data)
21+
for match in matches:
22+
if match[0] == 'PSQL':
23+
_category, transaction, time = match
24+
if transaction == "Transaction":
25+
PSQL_Transaction.append(int(time))
26+
else:
27+
PSQL_NonTransaction.append(int(time))
28+
else:
29+
_category, trees, storage, time = match
30+
if trees == 'United':
31+
if storage == 'Volatile':
32+
Doublets_United_Volatile.append(int(time))
33+
else:
34+
Doublets_United_NonVolatile.append(int(time))
35+
else:
36+
if storage == 'Volatile':
37+
Doublets_Split_Volatile.append(int(time))
38+
else:
39+
Doublets_Split_NonVolatile.append(int(time))
40+
41+
Doublets_United_Volatile = [max(1, x // 10000000) for x in Doublets_United_Volatile]
42+
Doublets_United_NonVolatile = [max(1, x // 10000000) for x in Doublets_United_NonVolatile]
43+
Doublets_Split_Volatile = [max(1, x // 10000000) for x in Doublets_Split_Volatile]
44+
Doublets_Split_NonVolatile = [max(1, x // 10000000) for x in Doublets_Split_NonVolatile]
45+
PSQL_NonTransaction = [max(1, x // 10000000) for x in PSQL_NonTransaction]
46+
PSQL_Transaction = [max(1, x // 10000000) for x in PSQL_Transaction]
47+
48+
labels = ['Create', 'Delete', 'Each Identity', 'Each Concrete', 'Each Outgoing', 'Each Incoming', 'Each All', 'Update']
49+
def bench1():
50+
y = np.arange(len(labels))
51+
52+
width = 0.1
53+
54+
fig, ax = plt.subplots(figsize=(12, 8))
55+
56+
57+
rects1 = ax.barh(y - 2*width, Doublets_United_Volatile, width, label='Doublets United Volatile', color='salmon')
58+
rects2 = ax.barh(y - width, Doublets_United_NonVolatile, width, label='Doublets United NonVolatile', color='red')
59+
60+
rects3 = ax.barh(y, Doublets_Split_Volatile, width, label='Doublets Split Volatile', color='lightgreen')
61+
rects4 = ax.barh(y + width, Doublets_Split_NonVolatile, width, label='Doublets Split NonVolatile', color='green')
62+
63+
rects5 = ax.barh(y + 2*width, PSQL_NonTransaction, width, label='PSQL NonTransaction', color='lightblue')
64+
rects6 = ax.barh(y + 3*width, PSQL_Transaction, width, label='PSQL Transaction', color='blue')
65+
66+
ax.set_xlabel('Time (ns) - Scaled to Pixels')
67+
ax.set_title('Benchmark comparison for Doublets and BM_PSQL')
68+
ax.set_yticks(y)
69+
ax.set_yticklabels(labels)
70+
ax.legend()
71+
72+
fig.tight_layout()
73+
74+
plt.savefig("Bench1.png")
75+
plt.close(fig)
76+
77+
def bench2():
78+
y = np.arange(len(labels))
79+
80+
width = 0.1
81+
fig, ax = plt.subplots(figsize=(12, 8))
82+
83+
rects1 = ax.barh(y - 2*width, Doublets_United_Volatile, width, label='Doublets United Volatile', color='salmon')
84+
rects2 = ax.barh(y - width, Doublets_United_NonVolatile, width, label='Doublets United NonVolatile', color='red')
85+
86+
rects3 = ax.barh(y, Doublets_Split_Volatile, width, label='Doublets Split Volatile', color='lightgreen')
87+
rects4 = ax.barh(y + width, Doublets_Split_NonVolatile, width, label='Doublets Split NonVolatile', color='green')
88+
89+
rects5 = ax.barh(y + 2*width, PSQL_NonTransaction, width, label='PSQL NonTransaction', color='lightblue')
90+
rects6 = ax.barh(y + 3*width, PSQL_Transaction, width, label='PSQL Transaction', color='blue')
91+
92+
ax.set_xlabel('Time (ns) - Logarithmic Scale')
93+
ax.set_title('Benchmark comparison for Doublets and BM_PSQL')
94+
ax.set_yticks(y)
95+
ax.set_yticklabels(labels)
96+
ax.legend()
97+
98+
ax.set_xscale('log')
99+
100+
fig.tight_layout()
101+
102+
plt.savefig("Bench2.png")
103+
plt.close(fig)
104+
105+
bench1()
106+
bench2()

0 commit comments

Comments
 (0)