Skip to content

Commit 149239e

Browse files
committed
update
1 parent 0b2c67c commit 149239e

File tree

6 files changed

+58
-3
lines changed

6 files changed

+58
-3
lines changed

cppcon2025/cppcon_2025_slides.md

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ paginate: true
77
_paginate: false
88
---
99

10+
![bg right](images/jsonmirror.png)
11+
12+
1013
# C++26 Reflection for JSON Serialization
1114
## A Practical Journey
1215

@@ -289,13 +292,13 @@ let player: Player = serde_json::from_str(&json_str)?;
289292
<img src="images/rust.png" width="10%" />
290293

291294
---
295+
![bg left](images/rust_reflection.jpg)
292296

293297
# Rust Reflection
294298

295299
* Rust does not have any built-in reflection capabilities.
296300
* Serde relies on annotation and macros.
297301

298-
<img src="images/rust_reflection.jpg" width="50%">
299302

300303
---
301304

@@ -553,9 +556,17 @@ The magic:
553556

554557
**3.4 GB/s** - 14x faster than nlohmann, 2.5x faster than Serde!
555558

559+
560+
---
561+
562+
563+
<img src="images/perf_with_simdjson_parsing.png" width="80%"/>
564+
565+
556566
---
557567

558-
# Ablation Study: How We Achieved 3.4 GB/s
568+
# Serialization Ablation Study
569+
## How We Achieved 3.4 GB/s
559570

560571
**What is Ablation?**
561572
From neuroscience: systematically remove parts to understand function

cppcon2025/cppcon_2025_slides_old.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -968,6 +968,13 @@ _mm512_cmple_epu8_mask(word, _mm512_set1_epi8(31));
968968

969969
**3.4 GB/s** - 14x faster than nlohmann, 2.5x faster than Serde!
970970

971+
972+
---
973+
974+
975+
<img src="images/perf_with_simdjson_parsing.png" width="80%"/>
976+
977+
971978
---
972979

973980
# Ablation Study: How We Achieved 3.2 GB/s
@@ -983,7 +990,7 @@ From neuroscience: systematically remove parts to understand function
983990

984991
---
985992

986-
# Five Key Optimizations
993+
# Three Key Optimizations
987994

988995
1. **Consteval**: Compile-time field name processing
989996
2. **SIMD String Escaping**: Vectorized character checks

cppcon2025/images/generate_perf_charts.py

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@
2626
plt.title('Current JSON Serialization Landscape', fontsize=16)
2727
plt.text(0.01, 0.99, 'Apple Silicon (M3 MAX)', transform=ax.transAxes,
2828
fontsize=14, ha='left', va='top', style='italic', color='black')
29+
30+
plt.text(0.01, 0.89, 'twitter.json', transform=ax.transAxes,
31+
fontsize=14, ha='left', va='top', style='italic', color='black')
2932
plt.tight_layout()
3033
plt.savefig('perf_landscape.png', dpi=300, bbox_inches='tight')
3134
plt.close()
@@ -60,10 +63,42 @@
6063
plt.title('JSON Serialization Performance', fontsize=16)
6164
plt.text(0.01, 0.99, 'Apple Silicon (M3 MAX)', transform=ax.transAxes,
6265
fontsize=14, ha='left', va='top', style='italic', color='black')
66+
plt.text(0.01, 0.89, 'twitter.json', transform=ax.transAxes,
67+
fontsize=14, ha='left', va='top', style='italic', color='black')
6368
plt.tight_layout()
6469
plt.savefig('perf_with_simdjson.png', dpi=300, bbox_inches='tight')
6570
plt.close()
6671

72+
73+
# Chart 2b: Parsing only (même style)
74+
plt.figure(figsize=(10, 6))
75+
bars = plt.bar(libraries_with, [172, 658, 1720, 2230, 4090], color=colors_with, edgecolor='black')
76+
ax = plt.gca()
77+
ax.spines['top'].set_visible(False)
78+
ax.spines['right'].set_visible(False)
79+
lang_labels = ["C++", "C++", "Rust", "C", "C++"]
80+
for i, bar in enumerate(bars):
81+
yval = bar.get_height()
82+
label = f'{yval} MB/s ' if libraries_with[i] == 'simdjson' else f'{yval} MB/s'
83+
plt.text(bar.get_x() + bar.get_width()/2, yval + 50, label,
84+
ha='center', va='bottom', fontsize=12)
85+
plt.text(bar.get_x() + bar.get_width()/2, yval + 180, lang_labels[i],
86+
ha='center', va='bottom', fontsize=12, color='black', fontweight='bold', style='italic')
87+
bars[-1].set_linewidth(3)
88+
bars[-1].set_edgecolor('#FF0000')
89+
plt.ylabel('Throughput (MB/s)', fontsize=14)
90+
plt.ylim(0, 4500)
91+
plt.title('JSON Parsing Performance', fontsize=16)
92+
plt.text(0.01, 0.99, 'Apple Silicon (M3 MAX)', transform=ax.transAxes,
93+
fontsize=14, ha='left', va='top', style='italic', color='black')
94+
plt.text(0.01, 0.89, 'twitter.json', transform=ax.transAxes,
95+
fontsize=14, ha='left', va='top', style='italic', color='black')
96+
plt.tight_layout()
97+
plt.savefig('perf_with_simdjson_parsing.png', dpi=300, bbox_inches='tight')
98+
plt.close()
99+
100+
101+
67102
# Chart 3: Final comparison (sorted)
68103
libraries_sorted = ["simdjson", "yyjson", "Serde (Rust)", "RapidJSON", "nlohmann::json"]
69104
speeds_sorted = [3435, 2074, 1343, 497, 242]
@@ -94,6 +129,8 @@
94129
plt.title('Twitter Dataset (631KB) - Serialization Performance', fontsize=16)
95130
plt.text(0.01, 0.99, 'Apple Silicon (M3 MAX)', transform=ax.transAxes,
96131
fontsize=14, ha='left', va='top', style='italic', color='black')
132+
plt.text(0.01, 0.89, 'twitter.json', transform=ax.transAxes,
133+
fontsize=14, ha='left', va='top', style='italic', color='black')
97134
plt.tight_layout()
98135
plt.savefig('perf_comparison.png', dpi=300, bbox_inches='tight')
99136
plt.close()

cppcon2025/images/jsonmirror.png

2.6 MB
Loading
7.15 KB
Loading
180 KB
Loading

0 commit comments

Comments
 (0)