This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
regcomp.c: Use values if known at compile time
authorKarl Williamson <public@khwilliamson.com>
Sat, 15 Dec 2012 04:43:14 +0000 (21:43 -0700)
committerKarl Williamson <public@khwilliamson.com>
Sat, 22 Dec 2012 18:11:29 +0000 (11:11 -0700)
commit2e3ac80a78b576a16430a6bd4e23fda08009ee8a
treebf986c65a1721cfdc14629ca439e1decf1bd7b65
parent92948144e49e98690ff80ee6f468210351bcccba
regcomp.c: Use values if known at compile time

When compiling a regular expression, it is too expensive to go out and
load from disk the list of code points that match a particular Posix
character class.  Some of these classes have so few code points, that
the lists are compiled in, but others are too large for that, for
example the list of code points that match \w.  (Also, it is known at
compile time which of the 256 code points within the Latin-1 range match
any Posix character class.)

The lists for beyond Latin-1 are demand-loaded upon first need for each,
thus the loading is deferred to execution time.  This is less efficient
than doing it at compilation time, but many many programs will never need
to load them, so the deferral is a big gain.  However, once loaded, they
stay loaded (in the current and all sub threads).  It may be that at the
time a regex is being compiled that a list it needs has already been
loaded for some other reason.  Then, the data is already available for
free, and this commit changes to use it for most Posix character
classes, and their complements.  This method replaces one that was
instituted just a few commits ago (I can't refer to its commit number,
because it is subject to change before the final push to blead; but it
has the same title as this commit.)

Future commits will expand the number of classes that use the mechanism
started in this commit
regcomp.c