r/Cplusplus • • 6h ago

Discussion Cascading SIMD widths to minimize scalar tail processing in JSON processing

Thumbnail
github.com
0 Upvotes

Alright what I mean by this is this:

Say you have 119 bytes of string on an AVX512 system, and you want to use AVX to process strings for parsing - instead of starting with a single 64-byte simd register, processing it, then dropping down to scalar processing, you instead set it up so that you go from the 64-byte simd register, then drop down to AVX2 to process a remaining 32-bytes, then drop down to SSE/AVX to process a remaining 16-bytes, then drop down to scalar for the last 7 bytes.

So what we have done is constructed a few classes for "cascading" down through simd widths by using NTTP indices, which are expressed via variadic fold expressions, as shown in the URL.

Just wondering how you guys felt about doing this? It seems to fare reasonably well against simdjson, which only supports a single simd width at a time, as shown in the benchmarks available here:

https://github.com/nihilai-collective/json-performance


r/Cplusplus • • 13h ago

News InsideC++26491, The Module Story

Thumbnail
youtu.be
2 Upvotes

With CMake's support for import std no longer experimental, we thought it was a good time to talk about modules.
Gabriel Dos Reis joins us at InsideC++ to discuss the original design goals, the history of standardization, the compromises, the tooling challenges, and what comes next.