Cure some of the slowness of
Jarkko Hietaniemi [Thu, 27 Jun 2002 16:10:17 +0000 (16:10 +0000)]
[ID 20020627.001] regex and utf-8 performance problem.

p4raw-id: //depot/perl@17370

regexec.c

index edbcd25..0c45fd0 100644 (file)
--- a/regexec.c
+++ b/regexec.c
@@ -431,7 +431,8 @@ Perl_re_intuit_start(pTHX_ regexp *prog, SV *sv, char *strpos,
              );
     });
 
-    if (prog->minlen > CHR_DIST((U8*)strend, (U8*)strpos)) {
+    /* CHR_DIST() would be more correct here but it makes things slow. */
+    if (prog->minlen > strend - strpos) {
        DEBUG_r(PerlIO_printf(Perl_debug_log,
                              "String too short... [re_intuit_start]\n"));
        goto fail;