On 11/3/06, Barry Roberts <[EMAIL PROTECTED]> wrote:
Java start-up time is big enough you're never gonna win the 5-line
test, but I can't resist suggesting this short-ciruit optimzation to
see how much difference it makes, since all the others do it.

Change:
     for (int i = 0; i < len; i++) {
to:
     for (int i = 0; i < len && !match; i++) {


Barry

My bad.  The benchmarked code was doing a short-circuit on the loop.
It actually had:

if (diff > len || diff == 0) {
 match == false;
 break;
}

Which does the same thing.  I like your code better though.

-Bryan

/*
PLUG: http://plug.org, #utah on irc.freenode.net
Unsubscribe: http://plug.org/mailman/options/plug
Don't fear the penguin.
*/

Reply via email to