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

Re: some thoughts on 8-bytes-at-a-time in the regex engine

Thread Previous
From:
Karl Williamson
Date:
January 5, 2017 22:19
Subject:
Re: some thoughts on 8-bytes-at-a-time in the regex engine
Message ID:
0d71119e-bf37-0205-1be0-c08c03d56f5b@khwilliamson.com
On 01/05/2017 08:10 AM, David Nicol wrote:
> On Wed, Jan 4, 2017 at 11:48 PM, Karl Williamson
> <public@khwilliamson.com> wrote:
>>
>> If we have a sequence that must all match, it seems to me we should be using
>> memcmp() regardless of alignment.
>
> or at least crib its comparison method versus length heuristic (if any.)
>
>

16 bytes in glibc.  Below that, and it does byte-by-byte comparisons. 
Above, and it goes byte-by-byte until at least one of the operands is 
aligned.  It then calls separate sub-functions depending on if both or 
just one operand is aligned.

I thought there might be some hardware support for this, but either I'm 
wrong, or don't know how or where to look for info about it.

I'm tempted to write an inline memcmp and change the macros like memEQ, 
memGE to use it.  It would loop if the length parameter is 16 or fewer 
bytes; otherwise call the real memcmp.

I think Dave was considering something like this, but hadn't gotten 
around to benchmarking it.

Thread Previous


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