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

Re: word-at-a-time searching for UTF-8 invariants

Thread Previous
From:
Karl Williamson
Date:
November 20, 2017 21:25
Subject:
Re: word-at-a-time searching for UTF-8 invariants
Message ID:
cc0f8c57-8205-2762-fc1d-079a3e251dde@khwilliamson.com
On 11/19/2017 02:59 AM, Sawyer X wrote:
> 
> 
> On 11/16/2017 08:03 PM, Karl Williamson wrote:
>> I have pushed a branch for review at
>>
>> https://perl5.git.perl.org/perl.git/shortlog/refs/heads/smoke-me/khw-invariant
>>
>>
>> which changes is_utf8_invariant_string_loc() (and hence
>> is_utf8_invariant_string(), which is defined as a special case of the
>> former) to use word-at-a-time (instead of per-byte) parsing through
>> the input string.
>>
>> This is commonly used functionality for parsing strings to decide if
>> they are UTF-8 and need to have the UTF-8 flag on.
>>
>> [...]
>>
>>
>> This means, for example, that the COND measurement is 800% faster.
> 
> Impressive!
> 
> What kind of user code would enjoy this speed up?
> 

This would speed up  things like parsing text for needing to  set the 
UTF-8 flag for a PV in a SV, and reading input text

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