Repository navigation
test: compare with isEqualTo instead of AssertJ containsExactly - #792
Merged
Merged
Conversation
dfa1
force-pushed
the
test/assertj-large-arrays
branch
from
November 30, 2026 06:16
2659ac7 to
caec696
Compare
AssertJ's containsExactly and containsExactlyElementsOf are O(n^2) even when they pass (assertj/assertj#4518): JavaWritesRustReads spent about 7 of its 11 seconds in them on 100k-200k arrays (11.0 s -> 4.1 s, sequential). containsExactly(<array or list>) and containsExactlyElementsOf(<list>) in the tests are now isEqualTo, a linear equals. Where containsExactly bridged a List and an array, the expected side is Arrays.asList(...); a Set's order is checked as List.copyOf(set). Kept as they were: varargs and literal calls, a single element passed as varargs, and lists of byte[] (AssertJ compares those by content, List.equals by reference). Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
dfa1
force-pushed
the
test/assertj-large-arrays
branch
from
November 30, 2026 06:30
caec696 to
0a56799
Compare
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.
AssertJ's
containsExactlyandcontainsExactlyElementsOfare O(n²) even when they pass (reported upstream as assertj/assertj#4518). On 3.27.7 with identical inputs, 200klong[]takes 4.4 s and a 200kList5.2 s;isEqualTotakes 0 ms.JavaWritesRustReadsIntegrationTestspent about 10 of its 19 seconds in six such calls on 100k–200k arrays.Every
containsExactly(<array or list>)andcontainsExactlyElementsOf(<list>)in the tests is nowisEqualTo(185 sites, 52 files). Varargs and literalcontainsExactlycalls stay. Where aListwas compared with an array, whichcontainsExactlybridged through varargs, the expected side isArrays.asList(...). The 13 such cases were in the writer tests, and the unit-test run found them.🤖 Generated with Claude Code