Skip to content

Conversation

@isadounikau
Copy link

Copy link
Contributor

@NathanQingyangXu NathanQingyangXu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

awesome. I wanna repeat the article link in the ticket here: https://medium.com/javarevisited/micro-optimizations-in-java-string-equals-22be19fd8416

gsmet
gsmet previously requested changes Aug 4, 2020
Copy link
Member

@gsmet gsmet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have absolutely no idea if it's really worth it (microbenchmarks on this sort of things can give an incorrect picture of what you really win) but I added a couple of comments in case this goes through.

Copy link
Member

@Sanne Sanne left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch!
Although I agree with @gsmet , this is unlikely to make any noticeable difference, but some of this code is very hot so why not.

The (minor) drawbacks I see:

  • it's less readable
  • if this pattern becomes "the standard way" one needs to be careful in not forgetting the null check
  • we're working primarily on ORM6, we should generally not make such changes on master: please prefer the wip/6.0 branch for such changes, in case you have more changes of this type

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants