Skip to content

Commit e07cb81

Browse files
committed
fix: chart label
1 parent fc46335 commit e07cb81

14 files changed

+23
-12
lines changed

reports/__assets__/Check time.png

-63 KB
Binary file not shown.

reports/__assets__/Memory used.png

-68.4 KB
Binary file not shown.

reports/__assets__/Program time.png

-62.8 KB
Binary file not shown.

reports/__assets__/Total time.png

-63.4 KB
Binary file not shown.

reports/__assets__/check_time.png

62.7 KB
Loading

reports/__assets__/i_o_read_time.png

63.1 KB
Loading

reports/__assets__/identifiers.png

62 KB
Loading

reports/__assets__/memory_used.png

66.5 KB
Loading

reports/__assets__/program_time.png

60.3 KB
Loading

reports/__assets__/symbols.png

60.7 KB
Loading

reports/__assets__/total_time.png

57.7 KB
Loading

reports/__assets__/types.png

59.9 KB
Loading

reports/benchmark_plotter.py

+18-12
Original file line numberDiff line numberDiff line change
@@ -17,31 +17,37 @@ def __init__(self, benchmarks: pd.DataFrame, dir: str):
1717
"zod": "#e377c2",
1818
}
1919
self.metrics = [
20-
"Memory used",
21-
"Program time",
22-
"Check time",
23-
"Total time",
20+
{"name": "Memory used", "unit": "Megabytes"},
21+
{"name": "Program time", "unit": "Seconds"},
22+
{"name": "Check time", "unit": "Seconds"},
23+
{"name": "Total time", "unit": "Seconds"},
24+
{"name": "Identifiers", "unit": "Count"},
25+
{"name": "Types", "unit": "Count"},
26+
{"name": "Symbols", "unit": "Count"},
27+
{"name": "I/O Read time", "unit": "Seconds"},
2428
]
2529

2630
def plot(self):
2731
for metric in self.metrics:
28-
self._plotMetric(metric)
32+
self._plotMetric(metricName=metric["name"], unit=metric["unit"])
2933

30-
def _plotMetric(self, metric: str):
34+
def _plotMetric(self, metricName: str, unit: str):
3135
df = self.benchmarks.reset_index()
32-
df = df[["Name", "Library", metric]]
33-
df = df.sort_values(by=[metric], ascending=False)
36+
df = df[["Name", "Library", metricName]]
37+
df = df.sort_values(by=[metricName], ascending=False)
3438
grouped = df.groupby(by=["Name"])
3539

3640
fig = plt.figure(figsize=(8, 12))
37-
fig.suptitle(f'{metric} comparison', fontsize=24)
41+
fig.suptitle(f'{metricName} comparison', fontsize=24)
3842

3943
for i, (names, group) in enumerate(grouped):
4044
ax = plt.subplot(len(grouped), 1, i + 1)
4145
colors = [self.colorMap[lib] for lib in group["Library"]]
42-
ax.barh(y=group["Library"], width=group[metric], color=colors)
46+
ax.barh(y=group["Library"], width=group[metricName], color=colors)
4347
ax.set_title(names[0])
48+
ax.set_xlabel(unit)
4449
ax.plot()
4550

46-
plt.subplots_adjust(wspace=0, hspace=0.5)
47-
plt.savefig(os.path.join(self.dir, f"{metric}.png"))
51+
fileName = metricName.replace(" ", "_").replace("/", "_").lower()
52+
plt.subplots_adjust(wspace=0, hspace=0.8)
53+
plt.savefig(os.path.join(self.dir, f"{fileName}.png"))

reports/benchmark_reader.py

+5
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,11 @@ def __init__(self, dir: str):
1616
"Check time",
1717
"Emit time",
1818
"Total time",
19+
"Identifiers",
20+
"Types",
21+
"Symbols",
22+
"I/O Write time",
23+
"I/O Read time",
1924
]
2025
self.benchmarks = self._buildBenchmarks(self.metrics, self.files)
2126

0 commit comments

Comments
 (0)