From 210e6c474f5ee0999067e3bcc136cd8bffc22f25 Mon Sep 17 00:00:00 2001 From: Karl Williamson Date: Thu, 5 Jan 2012 21:15:45 -0700 Subject: [PATCH] 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 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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; -- 2.7.4