Repository navigation
Look up the key only once in the callback parser's key() - #5831
Merged
Merged
Conversation
gregmarr
approved these changes
Oct 14, 2026
Signed-off-by: Niels Lohmann <mail@nlohmann.me>
nlohmann
force-pushed
the
claude/kind-goodall-cb86cf
branch
from
October 15, 2026 06:24
ddb5d36 to
908038c
Compare
nlohmann
added this pull request to stack #5841
October 15, 2026 06:24
gregmarr
approved these changes
Oct 15, 2026
nlohmann
added a commit
that referenced
this pull request
Oct 16, 2026
Fixes every CI failure develop has had since the API performance stack (#5831-#5842) was merged: compiler warnings and errors (Clang, GCC 4.9/11, MSVC 2015/2017/2022), clang-tidy, cpplint, Cppcheck, IWYU, the examples check, the no-exceptions, diagnostic-positions, implicit-conversions and strict-NUL test configurations, and the MinGW link (now with LLD). Signed-off-by: Niels Lohmann <mail@nlohmann.me>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Since #5466,
json_sax_dom_callback_parser::key()searched the object for a duplicate key withfind()and then looked the key up a second time withoperator[]to insert the placeholder. That doubled the tree lookups per member and madejson::parse(s, callback)on one very wide object slower than in 3.12.0. This replaces both lookups by a singleemplace(); duplicate-key semantics (stash and restore) are unchanged.Callback parse of
{"k0":0,…,"k31999":31999}(Apple M1 Max, clang, -O3, median of 31, interleaved, machine under load):Comparing #5466 with its parent at 32k members: 7.3 ms vs 10.4 ms. Plain parsing is unchanged.
Tests:
unit-class_parser,unit-diagnostic-positions,unit-regression2pass.API
No breaking changes.
🤖 Generated with Claude Code