summaryrefslogtreecommitdiff
path: root/regcomp.h
diff options
context:
space:
mode:
authorKarl Williamson <khw@cpan.org>2014-08-28 14:22:14 -0600
committerKarl Williamson <khw@cpan.org>2014-09-03 12:43:15 -0600
commite0a1ff7a2452ef34ae8bb33cda6415709f1833fc (patch)
treed7329013a042eabb460b8437df73ae9ba2a4405d /regcomp.h
parent8e8a446824eed109a7c437ac4a417de07db94cc4 (diff)
downloadperl-e0a1ff7a2452ef34ae8bb33cda6415709f1833fc.tar.gz
Allow for changing size of bracketed regex char class
This commit allows Perl to be compiled with a bitmap size that is larger than 256. This bitmap is used to directly look up whether a character matches or not, without having to do a binary search or hash lookup. It might improve the performance for some installations that have a lot of use of scripts that are above the Latin1 range.
Diffstat (limited to 'regcomp.h')
-rw-r--r--regcomp.h15
1 files changed, 14 insertions, 1 deletions
diff --git a/regcomp.h b/regcomp.h
index f1f55eb6f1..9b11ce5ee1 100644
--- a/regcomp.h
+++ b/regcomp.h
@@ -184,7 +184,20 @@ struct regnode_2 {
U16 arg2;
};
-#define NUM_ANYOF_CODE_POINTS 256
+/* This give the number of code points that can be in the bitmap of an ANYOF
+ * node. The shift number must currently be one of: 8..12. It can't be less
+ * than 8 (256) because some code relies on it being at least that. Above 12
+ * (4096), and you start running into warnings that some data structure widths
+ * have been exceeded, though the test suite as of this writing still passes
+ * for up through 16, which is as high as anyone would ever want to go,
+ * encompassing all of the Unicode BMP, and thus including all the economically
+ * important world scripts. At 12 most of them are: including Arabic,
+ * Cyrillic, Greek, Hebrew, Indian subcontinent, Latin, and Thai; but not Han,
+ * Japanese, nor Korean. (The regarglen structure in regnodes.h is a U8, and
+ * the trie types TRIEC and AHOCORASICKC are larger than U8 for shift values
+ * below above 12.) Be sure to benchmark before changing, as larger sizes do
+ * significantly slow down the test suite */
+#define NUM_ANYOF_CODE_POINTS (1 << 8)
#define ANYOF_BITMAP_SIZE (NUM_ANYOF_CODE_POINTS / 8) /* 8 bits/Byte */