james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Noel J. Bergman" <n...@devtech.com>
Subject RE: String.equalsIgnoreCase Considered Evil :-)
Date Mon, 05 Aug 2002 19:25:48 GMT
> Technically, this only happens if the string lengths are the same.
> equalsIgnoreCase is actually faster when the string lengths are
> different

As I said, check the test driver I posted.  SMTP and POP3 commands ARE the
same length, and are generally entered by the client in upper case.
String.toUpperCase is quite fast when there are no characters to change
(scans and returns this), so there is no object creation.  Even when an
object is created, it only pushes the breakeven point further down the
chain.

Yes, there are other scenarios where the equalsIgnoreCase path is quicker,
but in the normal case of a mail transaction, it is always quicker to call
toUpperCase on the command.

	--- Noel


--
To unsubscribe, e-mail:   <mailto:james-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:james-dev-help@jakarta.apache.org>


Mime
View raw message