lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tatu Saloranta <>
Subject Re: this == that
Date Sun, 30 Apr 2006 02:48:25 GMT
--- karl wettin <> wrote:

> The code is filled with string equality code using
> == rather than  
> equals(). I honestly don't think it saves a single
> clock tick as the  
> JIT takes care of it when the first line of code in
> the equals method  
> is if (this == that) return true;

In case where (this == that) is true, this may well be
correct, but:

> Please correct me if I'm wrong.

... you are then assuming 100% match rate: if so this
might be true. But in (this != that) case difference
will be more significant; after identity comparison
String lengths are compared, and if those match, then
char-by-char comparison.
So it probably does not make sense to de-optimize code
in this way.

-+ Tatu +-

Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message