e I poke around that.
> -Mensaje original-
> De: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED]]En nombre de
> [EMAIL PROTECTED]
> Enviado el: jueves, 07 de febrero de 2002 18:44
> Para: [EMAIL PROTECTED]
> Asunto: RE: [JBoss-dev] so how fast is string comparison
>
>
ubject: Re: [JBoss-dev] so how fast is string comparison
On Thu, 7 Feb 2002, marc fleury wrote:
> when we do
>
> if (string.equals("this"))
>
> else if (string.equals("that"))
>
> how much slower is it than
>
> switch (stringAsInt)
> case
On Thu, 7 Feb 2002, marc fleury wrote:
> when we do
>
> if (string.equals("this"))
>
> else if (string.equals("that"))
>
> how much slower is it than
>
> switch (stringAsInt)
> case THIS:
>
> case THAT:
If strings are final, then you can use ==, instead of the much slower
.equals().
A switch st
I'm slightly of topic, anyway
IMHO, Strings are dead slow when comparing to ints.
This is not because of string math (i.e. comparison, etc.)
but because of _new_ and _new_ Strings which takes
part in many methods with Strings involved
(and almost _every_ String finishes in GC)
So I look at jdk1
I tested exactly this a short while ago with some
'kindergarten test program' (simply timing loops)
Yes - I can hear them in the background shouting at
me what about VM optimization, which OS,
what machine, what else is running, bla bla ...
But I don't want to publish this in a scientific journal.
ent@Lists. Sourceforge. Net
> Asunto: [JBoss-dev] so how fast is string comparison
>
>
> when we do
>
> if (string.equals("this"))
>
> else if (string.equals("that"))
>
> how much slower is it than
>
> switch (stringAsInt)
> case THIS:
>
&
when we do
if (string.equals("this"))
else if (string.equals("that"))
how much slower is it than
switch (stringAsInt)
case THIS:
case THAT:
I assume a lot as String manipulation is just dead slow, but I could be
wrong, I really don't know.
marcf
___