develooper Front page | perl.perl5.porters | Postings from June 2014

Re: Seeking insight into when not to use a synthetic start classfor regex matching

Thread Previous | Thread Next
From:
Karl Williamson
Date:
June 29, 2014 02:05
Subject:
Re: Seeking insight into when not to use a synthetic start classfor regex matching
Message ID:
53AF7452.7020807@khwilliamson.com
On 02/10/2014 12:13 AM, demerphq wrote:
> In previous versions of perl we did this quite wrong:
>
> $ perl -Mre=debug -le'print $]; qr/[ab]?[cd]/'
> Compiling REx "[ab]?[cd]"
> synthetic stclass "ANYOF[\x00-\xff][]".
> Final program:
>     1: CURLY {0,1} (14)
>     3:   ANYOF[ab][] (0)
>    14: ANYOF[cd][] (25)
>    25: END (0)
> stclass ANYOF[\x00-\xff][] minlen 1
> 5.014002
> Freeing REx: "[ab]?[cd]"
>
> Which I guess you fixed. If so then thanks!

Out of curiosity, I found that this commit introduced the proper behavior:
  commit 1de063289cf096bd67e3d9d1b4a6dca2498966fa
  Author: Yves Orton <demerphq@gmail.com>
  Date:   Sun Sep 10 00:00:05 2006 +0200

   Teach regex optimiser how to handle (?=) and (?<=) properly.
      Message-ID: 
<9b18b3110609091300x1fd0b15dt32932902a0a80674@mail.gmail.com>

and this commit broke it:
commit 8951c461a5079d86be33a432491eda98c24dc397
Author: Karl Williamson <public@khwilliamson.com>
Date:   Tue Nov 9 22:05:44 2010 -0700

     PATCH: [perl #78994]: optimizer loses folding


and this commit re-introduced the proper behavior:
  commit 710680787cad21825395c0224606ac1535624c52
  Author: Karl Williamson <public@khwilliamson.com>
  Date:   Sun Jan 12 23:39:43 2014 -0700

      Use bit instead of node for regex SSC


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