Improve DocLineComparator performance #2575#2576
Draft
mehmet-karaman wants to merge 1 commit intoeclipse-platform:masterfrom
Draft
Improve DocLineComparator performance #2575#2576mehmet-karaman wants to merge 1 commit intoeclipse-platform:masterfrom
mehmet-karaman wants to merge 1 commit intoeclipse-platform:masterfrom
Conversation
Add a lightweight preliminary check before invoking String.equals(), which avoids unnecessary overhead while preserving correctness for other comparison cases. Fixes eclipse-platform#2575
Contributor
Author
|
Changed PR to draft, need to fix the test failures org.eclipse.compare.tests |
Contributor
Test Results 51 files - 3 51 suites - 3 35m 17s ⏱️ - 2m 46s For more details on these failures, see this check. Results for commit 85a4a63. ± Comparison against base commit 4f46e73. This pull request removes 21 tests. |
| return linesToCompare[0].equals(linesToCompare[1]); | ||
| String s1 = linesToCompare[0]; | ||
| String s2 = linesToCompare[1]; | ||
| if (s1.isEmpty() == s2.isEmpty()) { |
Member
There was a problem hiding this comment.
So two non empty lines are equal?
Contributor
Author
There was a problem hiding this comment.
How it comes? The first and the second check is just to avoid index out of bounds exceptions..
Member
There was a problem hiding this comment.
Put a breakpoint in the return true new line and run DocLineComparatorTest
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.
Add a lightweight preliminary check before invoking String.equals(), which avoids unnecessary overhead while preserving correctness for other comparison cases.
Fixes #2575