develooper Front page | perl.perl5.porters | Postings from January 2018

Re: Name that regnode

Thread Previous | Thread Next
From:
Karl Williamson
Date:
January 30, 2018 18:44
Subject:
Re: Name that regnode
Message ID:
0ee6cae3-fcbe-3ec3-e92b-f83a28f34d60@khwilliamson.com
On 01/29/2018 10:35 PM, Karl Williamson wrote:
> On 01/25/2018 10:37 AM, Father Chrysostomos wrote:
>> Karl Williamson wrote:
>>> But I don't like the name I came up with for this regnode, MASKED.  I'm
>>> open to suggestions for a better name.
>>
>> Existing char classes use ANYOF.  Maybe ANYOFMASK?  ANYPERMASK?
>>
> 
> I modified your first suggestion slightly to ANYOFM.
> 
> I now have some performance numbers:
> 
>   Key:
>           Ir   Instruction read
>           Dr   Data read
>           Dw   Data write
>           COND conditional branches
>           IND  indirect branches
> 
>       The numbers represent raw counts per loop iteration.
> 
>       Results of ('b' x 10000) . 'a' =~ /[Aa]/
> 
>                 blead    mask Ratio %
>              -------- ------- -------
>           Ir 153132.0 25636.0   597.3
>           Dr  40909.0  2155.0  1898.3
>           Dw  20593.0   593.0  3472.7
>         COND  20529.0  3028.0   678.0
>          IND     22.0    22.0   100.0
> 

And pushed as

commit 2813d4adc971fbaa124b5322d4bccaa73e9df8e2
  Author: Karl Williamson <khw@cpan.org>
  Date:   Mon Jan 29 20:47:56 2018 -0700

      Add ANYOFM regnode

      This is a specialized ANYOF node for use when the code points in it
      have characteristics that allow them to be matched with a mask instead
      of a bit map.

   ...

      The set of ASCII characters also could be done with this node 
instead of
      having the special ASCII regnode, reducing code size and complexity.
      I haven't investigated the speed loss of doing so.

      A NANYOFM node could be created for matching the complements this one
      matches.

      A pattern like /A/i is not affected by this commit, but the regex
      optimizer could be changed to take advantage of this commit.  What 
would
      need to be done is for it to look at the first byte of an 
EXACTFish node
      and if its one of the case pairs this handles, to generate a synthetic
      start class for it.  This would automatically invoke the sped up code.

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