Skip to content

Avoid Iterator allocations when calling Sort.isSorted() #2445

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

Closed
mp911de opened this issue Sep 7, 2021 · 1 comment
Closed

Avoid Iterator allocations when calling Sort.isSorted() #2445

mp911de opened this issue Sep 7, 2021 · 1 comment
Labels
type: task A general task

Comments

@mp911de
Copy link
Member

mp911de commented Sep 7, 2021

Sort.isSorted uses internally isEmpty which defaults to Streamable.isEmpty that obtains an iterator to check emptiness. We should implement isEmpty() properly to check whether the backing object is empty to avoid allocations.

@mp911de mp911de added the type: task A general task label Sep 7, 2021
@mp911de mp911de added this to the 2.4.13 (2020.0.13) milestone Sep 7, 2021
@mp911de mp911de closed this as completed in 242a71c Sep 7, 2021
@mp911de
Copy link
Member Author

mp911de commented Sep 7, 2021

Finding while benchmarking spring-projects/spring-data-mongodb#3760.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: task A general task
Projects
None yet
Development

No branches or pull requests

1 participant