Skip to content

Commit e5197d5

Browse files
committed
Adding new performance metrics from BenchmarkSuite.
1 parent cbe9106 commit e5197d5

File tree

296 files changed

+1359734
-1413926
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

296 files changed

+1359734
-1413926
lines changed

.github/workflows/Benchmark.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -334,11 +334,11 @@ jobs:
334334
sudo git fetch origin
335335
sudo git checkout benchmarking
336336
sudo git pull -f origin benchmarking
337-
sudo git merge origin/temp-msvc-windows --no-ff
338-
sudo git merge origin/temp-gnucxx-ubuntu --no-ff
339-
sudo git merge origin/temp-clang-ubuntu --no-ff
340-
sudo git merge origin/temp-gnucxx-macos --no-ff
341-
sudo git merge origin/temp-clang-macos --no-ff
337+
sudo git merge origin/temp-msvc-windows --no-ff --allow-unrelated-histories
338+
sudo git merge origin/temp-gnucxx-ubuntu --no-ff --allow-unrelated-histories
339+
sudo git merge origin/temp-clang-ubuntu --no-ff --allow-unrelated-histories
340+
sudo git merge origin/temp-gnucxx-macos --no-ff --allow-unrelated-histories
341+
sudo git merge origin/temp-clang-macos --no-ff --allow-unrelated-histories
342342
sudo git checkout --orphan newBranch
343343
sudo git add .
344344
sudo git commit -m "Updating necessary files."

CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ target_compile_definitions(
9494
"JSONIFIER_COMMIT=\"${JSONIFIER_COMMIT_HASH}\""
9595
"SIMDJSON_COMMIT=\"${SIMDJSON_COMMIT_HASH}\""
9696
"GLAZE_COMMIT=\"${GLAZE_COMMIT_HASH}\""
97+
"GIT_BRANCH=\"${GIT_BRANCH}\""
9798
"OPERATING_SYSTEM_NAME=\"${CMAKE_SYSTEM_NAME}\""
9899
"OPERATING_SYSTEM_VERSION=\"${CMAKE_SYSTEM_VERSION}\""
99100
"COMPILER_ID=\"${CMAKE_CXX_COMPILER_ID}\""

GenerateGraphs.py

Lines changed: 171 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,177 @@
44
import seaborn as sns
55
import matplotlib.pyplot as plt
66
import pandas as pd
7-
import re
87

98
def parse_args():
109
parser = argparse.ArgumentParser(description='Process benchmark results from a JSON file.')
1110
parser.add_argument('input_file', type=str, help='Path to the input JSON file')
12-
parser.add_argument('output_directory', type=str, help='Path to the store the graphs')
11+
parser.add_argument('output_directory', type=str, help='Path to store the graphs')
1312
return parser.parse_args()
1413

14+
def get_raw_speeds(df):
15+
raw_speeds = {"Read": [], "Write": []}
16+
libraries = df["libraryName"].unique()
17+
18+
for result_type in raw_speeds.keys():
19+
result_type_df = df[df["resultType"] == result_type].sort_values(by="resultSpeed")
20+
21+
if result_type_df.empty:
22+
raw_speeds[result_type] = [0] * len(libraries)
23+
continue
24+
25+
speed_map = dict(zip(result_type_df["libraryName"], result_type_df["resultSpeed"]))
26+
27+
raw_speeds[result_type] = [
28+
speed_map.get(library, 0) for library in libraries
29+
]
30+
31+
return raw_speeds
32+
33+
def calculate_cumulative_speedup(df):
34+
cumulative_speedups = {"Read": [], "Write": []}
35+
libraries = df["libraryName"].unique()
36+
37+
for result_type in cumulative_speedups.keys():
38+
result_type_df = df[df["resultType"] == result_type].sort_values(by="resultSpeed")
39+
40+
if result_type_df.empty:
41+
cumulative_speedups[result_type] = [0] * len(libraries)
42+
continue
43+
44+
slowest_speed = result_type_df.iloc[0]["resultSpeed"]
45+
result_type_speedups = [100]
46+
47+
for i in range(1, len(result_type_df)):
48+
current_speed = result_type_df.iloc[i]["resultSpeed"]
49+
speedup = ((current_speed / slowest_speed) - 1) * 100 + 100
50+
result_type_speedups.append(speedup)
51+
52+
speedup_map = dict(zip(result_type_df["libraryName"], result_type_speedups))
53+
cumulative_speedups[result_type] = [
54+
speedup_map.get(library, 0) for library in libraries
55+
]
56+
57+
return cumulative_speedups
58+
59+
def plot_cumulative_speedup(df, cumulative_speedups, output_folder, test_name):
60+
sns.set_style("dark")
61+
sns.set_style(rc={'axes.facecolor': '#0d1117'})
62+
plt.figure(figsize=(10, 6))
63+
ax = plt.gca()
64+
65+
sns.set_theme(style="whitegrid", rc={"axes.edgecolor": "#0d1117", "xtick.color": "#0d1117", "ytick.color": "#0d1117"})
66+
plt.gcf().set_facecolor("#0d1117")
67+
ax = plt.gca()
68+
69+
sorted_df = df.sort_values(by="resultSpeed", ascending=False)
70+
71+
library_colors = {}
72+
for _, row in sorted_df.iterrows():
73+
library_colors[(row['libraryName'], row['resultType'])] = row['color']
74+
75+
libraries = sorted_df["libraryName"].unique()
76+
77+
cumulative_speedup_read = cumulative_speedups.get("Read", [0] * len(libraries))
78+
cumulative_speedup_write = cumulative_speedups.get("Write", [0] * len(libraries))
79+
80+
num_libraries = len(libraries)
81+
max_libraries = max(2, num_libraries)
82+
width = 0.8 / max_libraries
83+
84+
for i, library in enumerate(libraries):
85+
read_speedup = cumulative_speedup_read[i] if i < len(cumulative_speedup_read) else 0
86+
write_speedup = cumulative_speedup_write[i] if i < len(cumulative_speedup_write) else 0
87+
88+
read_color = library_colors.get((library, 'Read'), 'gray')
89+
write_color = library_colors.get((library, 'Write'), 'gray')
90+
91+
font_size = max(8, width * 30)
92+
if read_speedup != 0:
93+
read_bar = ax.bar(i - width / 2, read_speedup, label=f"{library} Read", color=read_color, width=width)
94+
ax.text(i - width / 2, read_speedup - read_speedup * 0.05,
95+
f"{read_speedup:.2f}%", ha='center', va='top', color='black', fontsize=font_size, fontweight='bold')
96+
97+
if write_speedup != 0:
98+
write_bar = ax.bar(i + width / 2, write_speedup, label=f"{library} Write", color=write_color, width=width)
99+
ax.text(i + width / 2, write_speedup - write_speedup * 0.05,
100+
f"{write_speedup:.2f}%", ha='center', va='top', color='black', fontsize=font_size, fontweight='bold')
101+
102+
ax.set_xticks(range(len(libraries)))
103+
ax.set_xticklabels(libraries)
104+
ax.set_title(f'{test_name} Cumulative Speedup (Relative to Slowest Library)', color='white')
105+
ax.set_xlabel('Library Name', color='white')
106+
ax.set_ylabel('Cumulative Speedup (%)', color='white')
107+
108+
handles, labels = ax.get_legend_handles_labels()
109+
for text in ax.get_xticklabels() + ax.get_yticklabels():
110+
text.set_color('lightgray')
111+
112+
ax.legend(title='Library and Result Type', loc='best')
113+
114+
output_file_path_speedup = os.path.join(output_folder, f'{test_name}_Cumulative_Speedup.png')
115+
plt.savefig(output_file_path_speedup)
116+
plt.close()
117+
118+
def plot_raw_comparisons(df, raw_speeds, output_folder, test_name):
119+
sns.set_style("dark")
120+
sns.set_style(rc={'axes.facecolor': '#0d1117'})
121+
plt.figure(figsize=(10, 6))
122+
ax = plt.gca()
123+
124+
sns.set_theme(style="whitegrid", rc={"axes.edgecolor": "#0d1117", "xtick.color": "#0d1117", "ytick.color": "#0d1117"})
125+
plt.gcf().set_facecolor("#0d1117")
126+
ax = plt.gca()
127+
128+
sorted_df = df.sort_values(by="resultSpeed", ascending=False)
129+
130+
library_colors = {}
131+
for _, row in sorted_df.iterrows():
132+
library_colors[(row['libraryName'], row['resultType'])] = row['color']
133+
134+
libraries = sorted_df["libraryName"].unique()
135+
136+
cumulative_speedup_read = raw_speeds.get("Read", [0] * len(libraries))
137+
cumulative_speedup_write = raw_speeds.get("Write", [0] * len(libraries))
138+
139+
num_libraries = len(libraries)
140+
max_libraries = max(2, num_libraries)
141+
width = 0.8 / max_libraries
142+
143+
for i, library in enumerate(libraries):
144+
read_speedup = cumulative_speedup_read[i] if i < len(cumulative_speedup_read) else 0
145+
write_speedup = cumulative_speedup_write[i] if i < len(cumulative_speedup_write) else 0
146+
147+
read_color = library_colors.get((library, 'Read'), 'gray')
148+
write_color = library_colors.get((library, 'Write'), 'gray')
149+
font_size = max(8, width * 30)
150+
151+
if read_speedup != 0:
152+
read_bar = ax.bar(i - width / 2, read_speedup, label=f"{library} Read", color=read_color, width=width)
153+
ax.text(i - width / 2, read_speedup - read_speedup * 0.05,
154+
f"{read_speedup:.2f}MB/s", ha='center', va='top', color='black', fontsize=font_size, fontweight='bold')
155+
156+
if write_speedup != 0:
157+
write_bar = ax.bar(i + width / 2, write_speedup, label=f"{library} Write", color=write_color, width=width)
158+
ax.text(i + width / 2, write_speedup - write_speedup * 0.05,
159+
f"{write_speedup:.2f}MB/s", ha='center', va='top', color='black', fontsize=font_size, fontweight='bold')
160+
161+
162+
ax.set_xticks(range(len(libraries)))
163+
ax.set_xticklabels(libraries)
164+
ax.set_title(f'{test_name} Result Speed Comparison', color='white')
165+
ax.set_xlabel('Library Name', color='white')
166+
ax.set_ylabel('Result Speed (MB/s)', color='white')
167+
168+
handles, labels = ax.get_legend_handles_labels()
169+
for text in ax.get_xticklabels() + ax.get_yticklabels():
170+
text.set_color('lightgray')
171+
172+
ax.legend(title='Library and Result Type', loc='best')
173+
174+
output_file_path_speedup = os.path.join(output_folder, f'{test_name}_Results.png')
175+
plt.savefig(output_file_path_speedup)
176+
plt.close()
177+
15178
def main():
16179
args = parse_args()
17180
input_file = args.input_file
@@ -25,40 +188,15 @@ def main():
25188
for test in data:
26189
df = pd.DataFrame(test["results"])
27190

28-
sns.set_style("dark")
29-
sns.set_style(rc = {'axes.facecolor': '#0d1117' })
30-
plt.figure(figsize=(10, 6))
31-
ax = plt.gca()
32-
33-
for i, library in enumerate(df["libraryName"].unique()):
34-
library_data = df[df["libraryName"] == library]
35-
for j, result_type in enumerate(library_data["resultType"].unique()):
36-
result_data = library_data[library_data["resultType"] == result_type]
37-
color = result_data["color"].iloc[0]
38-
ax.bar(i + j * 0.2, result_data["resultSpeed"].iloc[0], width=0.2, color=color, label=result_type)
39-
40-
ax.set_xticks(range(len(df["libraryName"].unique())))
41-
ax.set_xticklabels(df["libraryName"].unique())
42-
ax.set_title(f'{test["testName"]} Results', color='white')
43-
outside_color = "#0d1117"
44-
ax.set_xlabel('Library Name', color='white')
45-
ax.set_ylabel('Result Speed MB/s', color='white')
46-
47-
sns.set_theme(style="whitegrid", rc={"axes.edgecolor": outside_color, "xtick.color": outside_color, "ytick.color": outside_color})
48-
plt.gcf().set_facecolor(outside_color)
49-
50-
handles, labels = ax.get_legend_handles_labels()
51-
for text in ax.get_xticklabels() + ax.get_yticklabels():
52-
text.set_color('lightgray')
191+
raw_speed = get_raw_speeds(df)
53192

54-
legend = ax.legend(title='Result Type', loc='best')
193+
cumulative_speedups = calculate_cumulative_speedup(df)
55194

56-
outside_color = "lightgray"
195+
plot_raw_comparisons(df, raw_speed , output_folder, test["testName"])
57196

58-
output_file_path = os.path.join(output_folder, f'{test["testName"]}_Results.png')
59-
plt.savefig(output_file_path)
197+
plot_cumulative_speedup(df, cumulative_speedups, output_folder, test["testName"])
60198

61-
print('Graphs saved successfully in the "Graphs" folder.')
199+
print(f'Graphs saved successfully for {test["testName"]}!')
62200

63201
if __name__ == "__main__":
64-
main()
202+
main()
45.4 KB
15.8 KB
45.4 KB
15.8 KB
47 KB
14.3 KB
46.4 KB

0 commit comments

Comments
 (0)