Skip to content

Split the slowest Valgrind tests out of unit-large_json and unit-bjdata - #5862

Merged
nlohmann merged 2 commits into
developfrom
fix/large-json-valgrind
Oct 17, 2026
Merged

nlohmann merged 2 commits into
developfrom
fix/large-json-valgrind

Conversation

@nlohmann

@nlohmann nlohmann commented Oct 16, 2026 •

Copy link
Copy Markdown
Owner

The Valgrind job fails on develop (cd6b428): test-large_json_cpp11_valgrind hits the 1500 s ctest timeout, and test-bjdata_cpp11_valgrind is right behind it (1464 s on develop; it timed out on this PR's first CI run).

This is not a performance regression. The tests simply grew: unit-large_json took 570 s under Valgrind on 633de8e (2026-09-29) and 1443 s on 4e294f4 (2026-10-14), after the deep-value tests (#5781, the BON8 writer fixes) were added to it; unit-bjdata grew with the round-trip invariants (#5569). Valgrind times also vary by about 20 % between runners, so a test near the limit fails at random.

This PR splits the slowest test cases into their own files, unchanged, so that they run in parallel:

file test cases native, -O0 Valgrind on CI (estimated)
unit-large_json.cpp tests on very large JSONs, tests on deeply nested JSONs 1.8 s ~640 s
unit-large_json_conversions.cpp (new) issue #5650 - stack overflow converting between specializations (was a section of "tests on deeply nested JSONs") 2.4 s ~840 s
unit-large_json_binary_writers.cpp (new) issue #5392 - binary writers on deeply nested values 3.1 s ~625 s (measured 193 s locally)
unit-bjdata.cpp everything else 0.9 s ~300 s
unit-bjdata_round_trip_draft2.cpp (new) BJData round-trip invariants, j1 written with Draft 2 1.9 s ~610 s
unit-bjdata_round_trip_draft3.cpp (new) BJData round-trip invariants, j1 written with Draft 3 1.9 s ~610 s

Before: unit-large_json 3.7 s, unit-bjdata 4.5 s. The estimates scale the native times by what CI measured for the combined tests.

The BJData round-trip check moves into tests/src/bjdata_round_trip.hpp; each half runs the same 36 option combinations per corpus value as before, split by the version that turns a corpus value into j1. Assertion counts are unchanged (667412 for BJData in total). The new BJData targets get the same /STACK link option on MSVC as test-bjdata. The tests themselves and the timeout are unchanged.

Checked locally: all files pass; GCC 16 with the CI warning flags (C++11 and C++20), Clang 22 with -Weverything and the CI exclusions, and clang-tidy 22 (silkeh/clang:22, as in CI) are clean on all new and changed files.

Breaking changes

No breaking changes; tests only.

🤖 Generated with Claude Code

Under Valgrind, test-large_json took 570 s on 2026-09-29 but 1443 s
by 2026-10-14, as the deep-value tests of #5781 and the BON8 fixes were
added to it, and it now exceeds the 1500 s ctest timeout on develop.
Moving the "issue #5392 - binary writers on deeply nested values" test
case into unit-large_json_binary_writers.cpp halves each test (natively
4.1 s and 3.4 s instead of 7.2 s), and the two run in parallel.

Signed-off-by: Niels Lohmann <mail@nlohmann.me>
The Valgrind job still timed out after the first split: unit-bjdata took
1464 s on develop (limit 1500 s) and timed out on this PR, and
unit-large_json still took 1292 s.

- The BJData round-trip invariants took 80 % of unit-bjdata. They move into
  tests/src/bjdata_round_trip.hpp, run by unit-bjdata_round_trip_draft2.cpp
  and unit-bjdata_round_trip_draft3.cpp, split by the BJData version that
  turns a corpus value into j1. Together they run the same 36 option
  combinations per corpus value as before.
- The "issue #5650" section (conversions between json and ordered_json)
  moves from unit-large_json into unit-large_json_conversions.cpp.

Native -O0 times: unit-bjdata 0.9 s, the two round-trip halves 1.9 s each
(was 4.5 s together); unit-large_json 1.8 s, unit-large_json_conversions
2.4 s (was 3.7 s). Assertion counts are unchanged.

Signed-off-by: Niels Lohmann <mail@nlohmann.me>
@github-actions github-actions Bot added aspect: binary formats BSON, CBOR, MessagePack, UBJSON CMake labels Oct 17, 2026
@nlohmann nlohmann changed the title Split the deep binary writer tests out of unit-large_json Split the slowest Valgrind tests out of unit-large_json and unit-bjdata Oct 17, 2026
@nlohmann
nlohmann merged commit 0e95fe8 into develop Oct 17, 2026
105 of 170 checks passed
@nlohmann
nlohmann deleted the fix/large-json-valgrind branch October 17, 2026 06:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

aspect: binary formats BSON, CBOR, MessagePack, UBJSON CMake L tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant