Skip to content
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

Added Identity Short Circuit to equals methods #27

Merged

Conversation

software-is-art
Copy link
Contributor

Summary

  • This is a micro optimisation for when equals is called with a reference to the same object
  • This is to avoid having consumers of equals performing this check themselves

Outstanding Concerns

Not sure how sensitive this code path will be to the extra branch. I would guess that it's fairly branch predictor friendly.

* This is a micro optimisation for when `equals` is called with a reference to the same object
@dweiss
Copy link
Member

dweiss commented Aug 30, 2021

Thanks. I was never a big fan of the this==other check - the gains seem to be in so marginal use cases that I almost never bother. But sure, why not. Can you add a changes entry to the patch and mention yourself as the contributor? Thanks.

@dweiss dweiss added this to the 0.9.1 milestone Aug 30, 2021
@software-is-art
Copy link
Contributor Author

Will do that first thing tomorrow.

I agree that in most cases it’s not going to be noticed. It’s really only because the use case we have at work is very sensitive to variance.

@dweiss dweiss merged commit dc57e6e into carrotsearch:master Aug 31, 2021
@dweiss
Copy link
Member

dweiss commented Aug 31, 2021

Thanks @software-is-art

@software-is-art
Copy link
Contributor Author

You’re welcome! Thanks for the great comms 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants