develooper Front page | perl.perl5.porters | Postings from September 2010

[perl #78024] PATCH: Make isFOO() O(1) performance, add variants for forcing ASCII, Latin1 interpretations

Thread Next
From:
karl williamson
Date:
September 23, 2010 22:37
Subject:
[perl #78024] PATCH: Make isFOO() O(1) performance, add variants for forcing ASCII, Latin1 interpretations
Message ID:
rt-3.6.HEAD-5116-1285306630-1502.78024-75-0@perl.org
# New Ticket Created by  karl williamson 
# Please include the string:  [perl #78024]
# in the subject line of all future correspondence about this issue. 
# <URL: http://rt.perl.org/rt3/Ticket/Display.html?id=78024 >


The attached series of commits changes the definitions of the character 
class macros in handy.h to use table lookup for all those that may 
require more than one comparison (leaving just isASCII() as not table 
lookup).

Variants of each one are added, with the ones whose names end in _A mean 
that they match only in the ASCII range, and those ending in _L1 match 
in the entire Latin1 range.

The first two commits are repeats of those in [perl #78022] PATCH: Add a 
couple of macros to handy.h.  The whole series is available at 
git://github.com/khwilliamson/perl.git branch autodoc.

The effect of this patch is both performance and extending capabilities. 
  Now all calls to these are O(1), and there are macros available to use 
for the /u and proposed /a or similar regular expression modifiers. 
Previously the macros could have executed many branches to classify the 
input.  Finding an ASCII word character could take 7 comparisons, quite 
a few more for Latin1.

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