summaryrefslogtreecommitdiff
path: root/unicode_constants.h
diff options
context:
space:
mode:
authorKarl Williamson <khw@cpan.org>2014-09-22 13:59:39 -0600
committerKarl Williamson <khw@cpan.org>2014-09-29 13:07:07 -0600
commitb35552de5cea8eb47ccb046284ecb9a099430255 (patch)
tree9cddbc9de1b38404bcf6fdae9e65f46b5a5d3e79 /unicode_constants.h
parentdea37815c59831b7e586fa51968348fbb8009e1a (diff)
downloadperl-b35552de5cea8eb47ccb046284ecb9a099430255.tar.gz
Tighten uses of regex synthetic start class
A synthetic start class (SSC) is generated by the regular expression pattern compiler to give a consolidation of all the possible things that can match at the beginning of where a pattern can possibly match. For example qr/a?bfoo/; requires the match to begin with either an 'a' or a 'b'. There are no other possibilities. We can set things up to quickly scan for either of these in the target string, and only when one of these is found do we need to look for 'foo'. There is an overhead associated with using SSCs. If the number of possibilities that the SSC excludes is relatively small, it can be counter-productive to use them. This patch creates a crude sieve to decide whether to use an SSC or not. If the SSC doesn't exclude at least half the "likely" possiblities, it is discarded. This patch is a starting point, and can be refined if necessary as we gain experience. See thread beginning with http://nntp.perl.org/group/perl.perl5.porters/212644 In many patterns, no SSC is generated; and with the advent of tries, SSC's have become less important, so whatever we do is not terribly critical.
Diffstat (limited to 'unicode_constants.h')
-rw-r--r--unicode_constants.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/unicode_constants.h b/unicode_constants.h
index 6cd8cc6b99..a7ddfeb9af 100644
--- a/unicode_constants.h
+++ b/unicode_constants.h
@@ -170,6 +170,9 @@
#endif /* EBCDIC POSIX-BC */
+/* The number of code points not matching \pC */
+#define NON_OTHER_COUNT_FOR_USE_ONLY_BY_REGCOMP_DOT_C 112806
+
#endif /* H_UNICODE_CONSTANTS */
/* ex: set ro: */