Improve DocLineComparator performance #2575#2576
Improve DocLineComparator performance #2575#2576mehmet-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
|
Changed PR to draft, need to fix the test failures org.eclipse.compare.tests |
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()) { |
There was a problem hiding this comment.
So two non empty lines are equal?
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..
There was a problem hiding this comment.
Put a breakpoint in the return true new line and run DocLineComparatorTest
There was a problem hiding this comment.
It is supposed to work only on the positive case :) Going to check this.
Add a lightweight preliminary check before invoking String.equals(), which avoids unnecessary overhead while preserving correctness for other comparison cases.
Fixes #2575