From 92d369e2172cb5cf0bc8fd6d3fb1fcaec35e2c88 Mon Sep 17 00:00:00 2001 From: Niels Lohmann Date: Fri, 6 Nov 2026 09:59:21 +0100 Subject: [PATCH] docs: blog post: note that Boost.JSON's tree lead comes from its arena The comparison builds Boost.JSON's tree in a monotonic_resource. With its default allocator and precise numbers, boost::json::parse() takes as long as json::parse() on twitter.json, 5% longer on citm_catalog.json and 17% less time on canada.json (M1, C++23 -O3, best of 3 x 30 runs; the arena saves Boost.JSON 28-41%). Signed-off-by: Niels Lohmann --- docs/mkdocs/docs/home/blog/how_3_13_0_got_faster.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/docs/mkdocs/docs/home/blog/how_3_13_0_got_faster.md b/docs/mkdocs/docs/home/blog/how_3_13_0_got_faster.md index f80c730a5..299278e30 100644 --- a/docs/mkdocs/docs/home/blog/how_3_13_0_got_faster.md +++ b/docs/mkdocs/docs/home/blog/how_3_13_0_got_faster.md @@ -1386,6 +1386,12 @@ needed, it is closer: on the Mac, a SAX handler is on par with Boost.JSON's, and Boost.JSON validates in 0.65–0.69× and sums in 0.75–0.79× the time). `dump()` writes faster than Boost.JSON, RapidJSON and serde_json, and about as fast as Glaze. +Much of Boost.JSON's lead in building a tree comes from its allocator: here it builds the tree in a +`monotonic_resource`, an arena that is freed in one go, which saves it 28–41%. With its default allocator, which +allocates every string, array, and object on its own as `json` does, `boost::json::parse()` with precise numbers takes +as long as `json::parse()` on `twitter.json`, 5% longer on `citm_catalog.json`, and 17% less time on `canada.json` (on +the Mac, freeing the tree included). + ### Results on x86-64 On x86-64, the same programs ran on a virtual server with Ubuntu 26.04 whose CPU presents itself as Haswell, pinned to