-
Notifications
You must be signed in to change notification settings - Fork 19.9k
feat: optimize SortUtils.swap
by skipping operations for equal indices
#5266
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #5266 +/- ##
============================================
+ Coverage 39.94% 39.96% +0.01%
- Complexity 2456 2458 +2
============================================
Files 519 519
Lines 15487 15488 +1
Branches 2957 2957
============================================
+ Hits 6187 6190 +3
+ Misses 9008 9007 -1
+ Partials 292 291 -1 ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is a pity that Collections.swap
is not directly applicable.
Yes. Maybe, if all the sorting is in lists. But that looks like perfectionism. But sorting implementations using arrays look more traditional from a computer science perspective. |
Such calls should be excluded.
SortUtils.swap
by skipping operations for equal indices
Adding check if indeces are not equals, for swap method in SortUtils.
According to this suggestion #5265 (comment)
clang-format -i --style=file path/to/your/file.java