From ac0c85ec53948417651090b82797b138966b6971 Mon Sep 17 00:00:00 2001 From: Daniel Lemire Date: Thu, 3 Dec 2026 11:47:15 -0500 Subject: [PATCH] Parsers of the conversion threads: no stage 1 thread of their own With SIMDJSON_THREADS_ENABLED, each document_stream starts a thread for stage 1, so N conversion threads ran 2N threads. On 32 cores of a Xeon Gold 6548N, NDJSON to MessagePack on 32 threads fell from 16.1 to 14.1 GB/s; with threaded = false in the workers' parsers it is back to 16.1. --- src/to_msgpack.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/to_msgpack.cpp b/src/to_msgpack.cpp index 7f35f96..5271d26 100644 --- a/src/to_msgpack.cpp +++ b/src/to_msgpack.cpp @@ -415,6 +415,10 @@ struct msgpack_writer::impl { std::vector
headers; std::vector> scratch; worker() { +#ifdef SIMDJSON_THREADS_ENABLED + // The threads already run in parallel: no stage 1 thread per parser. + parser.threaded = false; +#endif for (size_t k = 0; k < internal::slots_per_thread; k++) { scratch.emplace_back(new internal::buffer); }