From: Karl Williamson Date: Fri, 6 Jan 2012 04:15:45 +0000 (-0700) Subject: regexec.c: Use shared swash in bracketed character classes X-Git-Tag: accepted/trunk/20130322.191538~1208 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=210e6c474f5ee0999067e3bcc136cd8bffc22f25;p=platform%2Fupstream%2Fperl.git 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. --- diff --git a/regexec.c b/regexec.c index 4275b37..1bb0cea 100644 --- a/regexec.c +++ b/regexec.c @@ -6733,7 +6733,7 @@ S_reginclass(pTHX_ const regexp * const prog, register const regnode * const n, || (flags & ANYOF_IS_SYNTHETIC))))) { AV *av; - SV * const sw = regclass_swash(prog, n, TRUE, 0, (SV**)&av); + SV * const sw = core_regclass_swash(prog, n, TRUE, 0, (SV**)&av); if (sw) { U8 * utf8_p;