diff options
author | Karl Williamson <khw@cpan.org> | 2014-08-28 14:22:14 -0600 |
---|---|---|
committer | Karl Williamson <khw@cpan.org> | 2014-09-03 12:43:15 -0600 |
commit | e0a1ff7a2452ef34ae8bb33cda6415709f1833fc (patch) | |
tree | d7329013a042eabb460b8437df73ae9ba2a4405d /regcomp.h | |
parent | 8e8a446824eed109a7c437ac4a417de07db94cc4 (diff) | |
download | perl-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.h | 15 |
1 files changed, 14 insertions, 1 deletions
@@ -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 */ |