Skip to content

Commit f8fce50

Browse files
Adding mention on the perf script of the apple m3 max
1 parent a0cbe18 commit f8fce50

File tree

1 file changed

+91
-0
lines changed

1 file changed

+91
-0
lines changed
Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
import matplotlib.pyplot as plt
2+
3+
# Chart 1: Current landscape (without simdjson)
4+
libraries_landscape = ["nlohmann::json", "RapidJSON", "Serde (Rust)", "yyjson"]
5+
speeds_landscape = [242, 497, 1343, 2074]
6+
colors_landscape = ['#8B8680', '#6495ED', '#FF6F61', '#2ECC71']
7+
8+
plt.figure(figsize=(10, 6))
9+
bars = plt.bar(libraries_landscape, speeds_landscape, color=colors_landscape, edgecolor='black')
10+
11+
ax = plt.gca()
12+
ax.spines['top'].set_visible(False)
13+
ax.spines['right'].set_visible(False)
14+
15+
for bar in bars:
16+
yval = bar.get_height()
17+
plt.text(bar.get_x() + bar.get_width()/2, yval + 50, f'{int(yval)} MB/s',
18+
ha='center', va='bottom', fontsize=12)
19+
20+
plt.ylabel('Throughput (MB/s)', fontsize=14)
21+
plt.ylim(0, 2500)
22+
plt.title('Current JSON Serialization Landscape', fontsize=16)
23+
plt.text(0.99, 0.01, 'Apple Silicon (M3 MAX)', transform=ax.transAxes,
24+
fontsize=10, ha='right', va='bottom', style='italic', color='gray')
25+
plt.tight_layout()
26+
plt.savefig('perf_landscape.png', dpi=300, bbox_inches='tight')
27+
plt.close()
28+
29+
# Chart 2: With simdjson reveal
30+
libraries_with = ["nlohmann::json", "RapidJSON", "Serde (Rust)", "yyjson", "simdjson"]
31+
speeds_with = [242, 497, 1343, 2074, 3435]
32+
colors_with = ['#8B8680', '#6495ED', '#FF6F61', '#2ECC71', '#FFD700']
33+
34+
plt.figure(figsize=(10, 6))
35+
bars = plt.bar(libraries_with, speeds_with, color=colors_with, edgecolor='black')
36+
37+
ax = plt.gca()
38+
ax.spines['top'].set_visible(False)
39+
ax.spines['right'].set_visible(False)
40+
41+
for i, bar in enumerate(bars):
42+
yval = bar.get_height()
43+
label = f'{yval} MB/s ⭐' if libraries_with[i] == 'simdjson' else f'{yval} MB/s'
44+
plt.text(bar.get_x() + bar.get_width()/2, yval + 50, label,
45+
ha='center', va='bottom', fontsize=12)
46+
47+
# Highlight simdjson
48+
bars[-1].set_linewidth(3)
49+
bars[-1].set_edgecolor('#FF0000')
50+
51+
plt.ylabel('Throughput (MB/s)', fontsize=14)
52+
plt.ylim(0, 4000)
53+
plt.title('JSON Serialization Performance', fontsize=16)
54+
plt.text(0.99, 0.01, 'Apple Silicon (M3 MAX)', transform=ax.transAxes,
55+
fontsize=10, ha='right', va='bottom', style='italic', color='gray')
56+
plt.tight_layout()
57+
plt.savefig('perf_with_simdjson.png', dpi=300, bbox_inches='tight')
58+
plt.close()
59+
60+
# Chart 3: Final comparison (sorted)
61+
libraries_sorted = ["simdjson", "yyjson", "Serde (Rust)", "RapidJSON", "nlohmann::json"]
62+
speeds_sorted = [3435, 2074, 1343, 497, 242]
63+
colors_sorted = ['#FFD700', '#2ECC71', '#FF6F61', '#6495ED', '#8B8680']
64+
65+
plt.figure(figsize=(10, 6))
66+
bars = plt.bar(libraries_sorted, speeds_sorted, color=colors_sorted, edgecolor='black')
67+
68+
ax = plt.gca()
69+
ax.spines['top'].set_visible(False)
70+
ax.spines['right'].set_visible(False)
71+
72+
for i, bar in enumerate(bars):
73+
yval = bar.get_height()
74+
label = f'{yval} MB/s ⭐' if libraries_sorted[i] == 'simdjson' else f'{yval} MB/s'
75+
plt.text(bar.get_x() + bar.get_width()/2, yval + 50, label,
76+
ha='center', va='bottom', fontsize=12)
77+
78+
# Highlight simdjson
79+
bars[0].set_linewidth(3)
80+
bars[0].set_edgecolor('#FF0000')
81+
82+
plt.ylabel('Throughput (MB/s)', fontsize=14)
83+
plt.ylim(0, 4000)
84+
plt.title('Twitter Dataset (631KB) - Serialization Performance', fontsize=16)
85+
plt.text(0.99, 0.01, 'Apple Silicon (M3 MAX)', transform=ax.transAxes,
86+
fontsize=10, ha='right', va='bottom', style='italic', color='gray')
87+
plt.tight_layout()
88+
plt.savefig('perf_comparison.png', dpi=300, bbox_inches='tight')
89+
plt.close()
90+
91+
print("Performance charts generated successfully!")

0 commit comments

Comments
 (0)