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
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