Repository navigation
Avoid temporary arrays when comparing JSON array values - #95
Merged
Merged
Conversation
Compare elements lazily with the existing recursive JSON equality rules. Keep the length check and stop at the first differing value. Cover const, enum, uniqueItems, nested values, views, issue paths, and allocation growth. AI disclosure: This work was prepared with assistance from OpenAI Codex.
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.
Array comparisons for
const,enum, anduniqueItemsbuild a Boolean array before testing whether every element matches. Nested arrays repeat that allocation at every level, and a mismatch at the first element still compares the entire array. Compare the existing recursive JSON equality function overzipinstead, retaining the length check and stopping at the first difference.The same JSON value rules are preserved: array order matters, equal numeric values compare equal, booleans remain distinct from numbers, and the existing
nothing/missingnull handling is unchanged. These follow Draft 7 instance equality.Warmed median allocations for public
validatecalls on Julia 1.13.1/macOS ARM, excluding input/schema construction:const, 100,000 equal integersconst, 100,000 integers with first item differentenum, first candidate is 100,000 equal integersconst, 10,000 nested arrays of four integersconst, 10 equal integersThese are local medians over eleven warmed samples. Fully equal flat 100,000-item arrays were slower in these runs (about 17 to 28 microseconds); early differences and nested comparisons were faster. This prioritizes bounded allocations and short-circuiting and does not claim a uniform throughput improvement.
Validation: all 5,642 checks pass on actual Julia 1.9.4 and 1.13.1 with four threads and bounds checking, including 4,492 official corpus checks and 162 new controls for equality symmetry, empty/unequal arrays, views, nested objects/nulls/booleans, failure paths/pointers, and successful/early-failing allocation growth. The unchanged current base passes 160 controls and fails the two allocation guards. JuliaFormatter 2.14.0's read-only check passes. An independent agent privately reviewed the final source/tests and found no blocker. No API, export, dependency, or version changes.
Hosted validation at
bf69159df7c478b9be06e14f49461776eda40840: all six Julia 1.10/current jobs on Linux, macOS, and Windows, plus formatting, pass. All six coverage uploads were accepted for this repository and commit and processed at 96.25%; the stable Linux log confirms strict OIDC upload success.Post-merge validation at
4982236495a50af33bd7dd413a39d6c36facf40a: all six native jobs and formatting pass. All six coverage reports were accepted and processed for the merge commit at 96.25%. The fetched merge tree matches the tested tree.Co-authored by Codex
AI disclosure: This work was prepared with assistance from OpenAI Codex.