http://qs1969.pair.com?node_id=1176249


in reply to Re: Faster regex to split a string into runs of similar characters?
in thread Faster regex to split a string into runs of similar characters?

Never would have thought of that! It yeilds another nice chunk of savings in the real application:

C:\test>\perl22\bin\perl 1176081.pl -WIDTH=1000 -HEIGHT=1000 yr() took 2.551594 buk() took 1.068262 buk2() took 0.681494 buk3() took 0.167000 dave() took 0.127978

Thanks.

On a related note: Any ideas why this:

while( substr( $$str, $y * $WIDTH, $WIDTH ) =~ m[((.)\2*)]mg ) { ...

Works (runs to completion, produces the desired results) on 5.10.1, but silently loops forever in 5.22.0?

This works in 5.22.0:

my $ref = \substr( $$str, $y * $WIDTH, $WIDTH ); while( $$ref =~ m[((.)\2*)]mg ) {

With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority". The enemy of (IT) success is complexity.
In the absence of evidence, opinion is indistinguishable from prejudice.

Replies are listed 'Best First'.
Re^3: Faster regex to split a string into runs of similar characters?
by dave_the_m (Monsignor) on Nov 21, 2016 at 14:16 UTC
    On a related note: Any ideas why this:
    while( substr( $$str, $y * $WIDTH, $WIDTH ) =~ m[((.)\2*)]mg ) { ...
    Works (runs to completion, produces the desired results) on 5.10.1, but silently loops forever in 5.22.0?
    Looks like a bug fix. expr =~ /.../g attaches position magic to the LHS after each match, to record the current pos() for that expression. If expr is a var or similar this works well; if expr returns something new each time, the old pos magic gets lost.

    This similarly loops forever:

    sub f { "abc" } 1 while f() =~ /./g;

    Dave.