Skip to content

Commit e9f403b

Browse files
Pushing latest changes
1 parent f8fce50 commit e9f403b

File tree

1 file changed

+6
-59
lines changed

1 file changed

+6
-59
lines changed

cppcon2025/cppcon_2025_slides.md

Lines changed: 6 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -434,7 +434,7 @@ Player p = simdjson::from(json);
434434
```cpp
435435
struct Meeting {
436436
std::string title;
437-
std::chrono::system_clock::time_point start_time;
437+
long long start_time;
438438
std::vector<std::string> attendees;
439439
std::optional<std::string> location;
440440
bool is_recurring;
@@ -443,7 +443,9 @@ struct Meeting {
443443
// Automatically serializable/deserializable!
444444
std::string json = simdjson::to_json(Meeting{
445445
.title = "CppCon Planning",
446-
.start_time = std::chrono::system_clock::now(),
446+
.start_time = std::chrono::duration_cast<std::chrono::milliseconds>(
447+
std::chrono::system_clock::now().time_since_epoch()
448+
).count(),
447449
.attendees = {"Alice", "Bob", "Charlie"},
448450
.location = "Denver",
449451
.is_recurring = true
@@ -452,21 +454,7 @@ std::string json = simdjson::to_json(Meeting{
452454
Meeting m = simdjson::from(json);
453455
```
454456

455-
---
456-
457-
# The Entire API Surface
458-
459-
Just two functions. Infinite possibilities.
460-
461-
```cpp
462-
simdjson::to_json(object) // → JSON string
463-
simdjson::from(json) // → T object
464-
```
465-
466-
That's it.
467-
468-
No macros. No class/struct instrusion. No external tools.
469-
Just simdjson leveraging C++26 reflection.
457+
Try out this example [here](https://godbolt.org/z/WWGjhnjWW)
470458

471459
---
472460

@@ -484,9 +472,8 @@ How do we automatically serialize ALL these different containers?
484472

485473
---
486474

487-
# The Naive Approach: Without Concepts
475+
# The Naive Approach
488476

489-
Without concepts, you'd need a separate function for EACH container type:
490477

491478
```cpp
492479
// The OLD way - repetitive and error-prone! 😱
@@ -542,46 +529,6 @@ The magic:
542529
543530
---
544531
545-
# Does your string need escaping?
546-
547-
- In JSON, you must escape control characters, quotes.
548-
- Most strings in practice do not need escaping.
549-
550-
551-
```Cpp
552-
bool simple_needs_escaping(std::string_view v) {
553-
for (unsigned char c : v) {
554-
if(json_quotable_character[c]) { return true; }
555-
}
556-
return false;
557-
}
558-
```
559-
560-
561-
---
562-
563-
# SIMD (Pentium 4 and better)
564-
565-
```cpp
566-
__m128i word = _mm_loadu_si128(data); // load 16 bytes
567-
// check for control characters:
568-
_mm_cmpeq_epi8(_mm_subs_epu8(word, _mm_set1_epi8(31)),
569-
_mm_setzero_si128());
570-
```
571-
572-
---
573-
574-
# SIMD (AVX-512)
575-
576-
```cpp
577-
__m512i word = _mm512_loadu_si512(data); // load 64 bytes
578-
// check for control characters:
579-
_mm512_cmple_epu8_mask(word, _mm512_set1_epi8(31));
580-
```
581-
582-
---
583-
584-
# Current JSON Serialization Landscape
585532
586533
<img src="images/perf_landscape.png" width="85%"/>
587534

0 commit comments

Comments
 (0)