This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Speedup (rn|n)?instr
authorAndy Lester <andy@petdance.com>
Thu, 22 Dec 2005 16:38:39 +0000 (10:38 -0600)
committerNicholas Clark <nick@ccl4.org>
Fri, 23 Dec 2005 00:06:52 +0000 (00:06 +0000)
Message-ID: <20051222223839.GI4370@petdance.com>
Date: Thu, 22 Dec 2005 16:38:39 -0600

p4raw-id: //depot/perl@26456

util.c

diff --git a/util.c b/util.c
index d8b28f2..5e5ba78 100644 (file)
--- a/util.c
+++ b/util.c
@@ -303,9 +303,11 @@ Perl_instr(pTHX_ register const char *big, register const char *little)
        for (x=big,s=little; *s; /**/ ) {
            if (!*x)
                return Nullch;
        for (x=big,s=little; *s; /**/ ) {
            if (!*x)
                return Nullch;
-           if (*s++ != *x++) {
-               s--;
+           if (*s != *x)
                break;
                break;
+           else {
+               s++;
+               x++;
            }
        }
        if (!*s)
            }
        }
        if (!*s)
@@ -332,9 +334,11 @@ Perl_ninstr(pTHX_ register const char *big, register const char *bigend, const c
        if (*big++ != first)
            continue;
        for (x=big,s=little; s < littleend; /**/ ) {
        if (*big++ != first)
            continue;
        for (x=big,s=little; s < littleend; /**/ ) {
-           if (*s++ != *x++) {
-               s--;
+           if (*s != *x)
                break;
                break;
+           else {
+               s++;
+               x++;
            }
        }
        if (s >= littleend)
            }
        }
        if (s >= littleend)
@@ -361,9 +365,11 @@ Perl_rninstr(pTHX_ register const char *big, const char *bigend, const char *lit
        if (*big-- != first)
            continue;
        for (x=big+2,s=little; s < littleend; /**/ ) {
        if (*big-- != first)
            continue;
        for (x=big+2,s=little; s < littleend; /**/ ) {
-           if (*s++ != *x++) {
-               s--;
+           if (*s != *x)
                break;
                break;
+           else {
+               x++;
+               s++;
            }
        }
        if (s >= littleend)
            }
        }
        if (s >= littleend)