You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@turbine.apache.org by John McNally <jm...@collab.net> on 2001/08/10 06:37:23 UTC

Re: cvs commit: jakarta-turbine/src/java/org/apache/turbine/util/parser DefaultParameterParser.java

dlr@apache.org wrote:
> 
>   -                    if ( tmp.length() != 0 )
>   +                    if (tmp.length() > 0)
>                        {

Anyone know one way or another if there is any performance hit to using
> 0 over != 0 when comparing a function return value that is known never to be negative?  Probably inconsequential, but it just seems like the != would be a cheaper operation.

john mcnally

---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-dev-help@jakarta.apache.org


Re: cvs commit: jakarta-turbine/src/java/org/apache/turbine/util/parser DefaultParameterParser.java

Posted by Daniel Rall <dl...@finemaltcoding.com>.
John McNally <jm...@collab.net> writes:

> dlr@apache.org wrote:
> > 
> >   -                    if ( tmp.length() != 0 )
> >   +                    if (tmp.length() > 0)
> >                        {
> 
> Anyone know one way or another if there is any performance hit to using
> > 0 over != 0 when comparing a function return value that is known never to be negative?  Probably inconsequential, but it just seems like the != would be a cheaper operation.

I wouldn't think so.  In x86 assembler, both "equal" and "greater
than" are single op codes.  I don't see why this should be any
different in a x86 JVM.

Dan

---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-dev-help@jakarta.apache.org