This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
regexec.c: Use shared swash in bracketed character classes
authorKarl Williamson <public@khwilliamson.com>
Fri, 6 Jan 2012 04:15:45 +0000 (21:15 -0700)
committerKarl Williamson <public@khwilliamson.com>
Fri, 13 Jan 2012 16:58:39 +0000 (09:58 -0700)
commit210e6c474f5ee0999067e3bcc136cd8bffc22f25
treebf66942ef74b1e0e95226c1d5cf4b5d6dec368fd
parent6c6525b86477e0001fa63ee65eb355329aeef26a
regexec.c: Use shared swash in bracketed character classes

This takes advantage of an earlier commit to use a swash that may be
shared across multiple character class instances.  That means that if a
match in another class has to look up a value, that that same value is
automatically available without further lookup to all character classes
that share the swash.  This means that the lookup result only needs be
cached once for all instances in the thread, saving time and memory.

Note that currently the only swashes that are shared are those that
consist solely of a single Unicode property definition.  Some sort of
checksum would have to be computed if this were to be extended to
custom classes.  But what this does is cause sharing for all Unicode
properties that aren't in bracketed classes (as they are implemented as
a bracketed class with a single element), as well as the few cases where
someone explicitly writes [\p{foo}] without anything else in the class.
regexec.c