-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathplot_memory.py
More file actions
64 lines (53 loc) · 1.66 KB
/
Copy pathplot_memory.py
File metadata and controls
64 lines (53 loc) · 1.66 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
import matplotlib.pyplot as plt
import pandas as pd
import seaborn as sns
IMPL_RENAMES = {
'ajv-bun': 'ajv',
'blaze': 'Blaze',
'boon': 'Boon',
'corvus': 'Corvus',
'go-jsonschema': 'jsonschema (Go)',
'jsu-c': 'JSU (C)',
'jsu-java': 'JSU (Java)',
'jsu-js': 'JSU (JS)',
'jsu-pl': 'JSU (Perl)',
'jsu-py': 'JSU (Python)',
'jsdotnet': 'JsonSchema.Net',
'jsv': 'JSV',
'kmp': 'KMP',
'networknt': 'NetworkNT',
'py-jsonschema': 'jsonschema (Py)',
}
if __name__ == "__main__":
data = pd.read_csv('dist/report.csv')
# Exclude implementations we are not comparing
data = data[~data['implementation'].isin(['ajv-bun', 'hyperjump', 'opis'])]
data['implementation'] = data['implementation'].replace(IMPL_RENAMES)
# Exclujde any failed implementations
data = data[data['exit_status'] == 0]
# Pick only the columns we need
data = data[['implementation', 'name', 'memory']]
# Average memory use across runs
data = (
data
.groupby(["implementation", "name"])
.mean()
.astype("int")
)
# Draw the plot
fig, ax1 = plt.subplots(figsize=(6, 3), dpi=96)
sns.set(font_scale=0.5)
plot = sns.boxplot(data, x='implementation', y='memory')
# Configure the x axis
plot.set(xlabel=None)
plot.tick_params(axis="x", rotation=50)
plt.tight_layout()
# Configure the y axis
ax1.set(yscale='log')
ax1.set_ylabel("Max memory usage (KB)")
plot.get_figure().savefig(
f"dist/results/plots/memory.png", dpi=96, bbox_inches="tight"
)
plot.get_figure().savefig(
f"dist/results/plots/memory.svg", dpi=96, bbox_inches="tight"
)