develooper Front page | perl.perl5.porters | Postings from July 2000

Re: [ID 20000626.002] Slow s/// in 5.6 compared to 5.00403?

Thread Previous | Thread Next
From:
Hugo
Date:
July 13, 2000 20:28
Subject:
Re: [ID 20000626.002] Slow s/// in 5.6 compared to 5.00403?
Message ID:
200007140235.DAA15458@crypt.compulink.co.uk
Mike Guy followed up on Per Lindquist's bug report with:
:Here's a cut down version of your test case which shows the effect:
:
:    use re 'debug';
:    $_ = "P FIRST = 0\nP " . join(" = 0\nP ", 1..5) . " = 0\nP LAST = 0\n";
:    /(.*)LAST(.*=).*/;
[...]
:Back to the bug:   the debug output shows that in perl5.005_03, the
:RE engine is indeed behaving as described above.    But the output
:under perl5.6.0 shows that instead of the quadratic rummage over
:'P FIRST = 0', it's doing a cubic search.

This is caused by the change commented out below. I'll try to see if
I can determine when that change helps, and if there is some way to
distinguish the cases.

It would help if I could determine which patch applied the change, and
see the comments that accompanied it: if anyone knows of a way to
discover this I would love to know of it. Barrie Slaymaker's excellent
source browser was great while it lasted (or perhaps it just moved
without me being aware of it - Barrie?), and I don't know of a useful
replacement.

Hugo
---
WARNING: not a proposed patch, just an indication of the problem area.
--- regexec.c.old	Fri Jul 14 03:19:57 2000
+++ regexec.c	Fri Jul 14 03:20:40 2000
@@ -1398,7 +1398,7 @@
 		dontbother = minlen - 1;
 	    end = HOPc(strend, -dontbother) - 1;
 	    /* for multiline we only have to try after newlines */
-	    if (prog->check_substr) {
+/*	    if (prog->check_substr) {
 		if (s == startpos)
 		    goto after_try;
 		while (1) {
@@ -1416,7 +1416,7 @@
 			s++;
 		}		
 	    } else {
-		if (s > startpos)
+*/		if (s > startpos)
 		    s--;
 		while (s < end) {
 		    if (*s++ == '\n') {	/* don't need PL_utf8skip here */
@@ -1425,8 +1425,8 @@
 		    }
 		}		
 	    }
-	}
-	goto phooey;
+/*	}
+*/	goto phooey;
     } else if (prog->reganch & ROPT_ANCH_GPOS) {
 	if (regtry(prog, PL_reg_ganch))
 	    goto got_it;

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About