diff options
author | Karl Williamson <public@khwilliamson.com> | 2013-07-21 10:10:56 -0600 |
---|---|---|
committer | Karl Williamson <public@khwilliamson.com> | 2013-09-24 11:36:11 -0600 |
commit | feb47a1ede0020680fa8011e14327590a2f2550c (patch) | |
tree | c2b8e1aba359bfe3c647eecf2c482afe9e2cbc83 /regcomp.c | |
parent | 647d194c710f5704f11d2db1ccd47fef8710d87b (diff) | |
download | perl-feb47a1ede0020680fa8011e14327590a2f2550c.tar.gz |
regcomp.c: Remove redundant matching possibilities
The flag ANYOF_UNICODE_ALL is for performance. It is set when the
inversion list for the ANYOF node includes every code point above
Latin1, and avoids runtime searching through the list. We don't need
both, as the flag being set short-circuits even looking at the other
list. By removing the code points from the list, we perhaps will get
rid of the list entirely, thus saving some operations, or will shorten
it so that later binary searches run faster.
Diffstat (limited to 'regcomp.c')
-rw-r--r-- | regcomp.c | 6 |
1 files changed, 5 insertions, 1 deletions
@@ -13982,10 +13982,14 @@ parseit: invlist_iterfinish(cp_list); /* Done with loop; remove any code points that are in the bitmap from - * <cp_list> */ + * <cp_list>; similarly for code points above latin1 if we have a flag + * to match all of them anyways */ if (change_invlist) { _invlist_subtract(cp_list, PL_Latin1, &cp_list); } + if (ANYOF_FLAGS(ret) & ANYOF_UNICODE_ALL) { + _invlist_intersection(cp_list, PL_Latin1, &cp_list); + } /* If have completely emptied it, remove it completely */ if (_invlist_len(cp_list) == 0) { |