mirror of
https://github.com/nlohmann/json.git
synced 2026-11-06 20:49:21 +00:00
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 <mail@nlohmann.me>
This commit is contained in:
1 file changed
+6
@@ -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
|
||||
|
||||
Reference in new issue
Block a user