=head2 Trie optimization for regexp engine
The regexp engine is now able to factorize common prefixes and suffixes in
-regular expressions. A new special variable, ${^RE_TRIE_MAXBUFF}, has been
+regular expressions. A new special variable, ${^RE_TRIE_MAXBUF}, has been
added to fine tune this optimization.
=head1 Installation and Configuration Improvements
The current value of the regex debugging flags. Set to 0 for no debug output
even when the re 'debug' module is loaded. See L<re> for details.
-=item ${^RE_TRIE_MAXBUFF}
+=item ${^RE_TRIE_MAXBUF}
Controls how certain regex optimisations are applied and how much memory they
utilize. This value by default is 65536 which corresponds to a 512kB temporary
});
- re_trie_maxbuff=get_sv(RE_TRIE_MAXBUFF, 1);
+ re_trie_maxbuff = get_sv(RE_TRIE_MAXBUF_NAME, 1);
if (!SvIOK(re_trie_maxbuff)) {
- sv_setiv(re_trie_maxbuff, TRIE_SIMPLE_MAX_BUFF);
+ sv_setiv(re_trie_maxbuff, RE_TRIE_MAXBUF_INIT);
}
/* -- First loop and Setup --
/*
We now know what we are dealing with in terms of unique chars and
string sizes so we can calculate how much memory a naive
- representation using a flat table will take. If its over a reasonable
- limit (as specified by $^RE_TRIE_MAXBUFF) we use a more memory
+ representation using a flat table will take. If it's over a reasonable
+ limit (as specified by ${^RE_TRIE_MAXBUF}) we use a more memory
conservative but potentially much slower representation using an array
of lists.
it would just call its tail, no WHILEM/CURLY needed.
*/
- if (DO_TRIE) {
- if (!re_trie_maxbuff) {
- re_trie_maxbuff=get_sv(RE_TRIE_MAXBUFF, 1);
- if (!SvIOK(re_trie_maxbuff))
- sv_setiv(re_trie_maxbuff, TRIE_SIMPLE_MAX_BUFF);
-
- }
+ if (DO_TRIE) {
+ if (!re_trie_maxbuff) {
+ re_trie_maxbuff = get_sv(RE_TRIE_MAXBUF_NAME, 1);
+ if (!SvIOK(re_trie_maxbuff))
+ sv_setiv(re_trie_maxbuff, RE_TRIE_MAXBUF_INIT);
+ }
if ( SvIV(re_trie_maxbuff)>=0 && OP( startbranch )==BRANCH ) {
regnode *cur;
regnode *first = (regnode *)NULL;
regnode *noper = NEXTOPER( cur );
regnode *noper_next = regnext( noper );
-
DEBUG_OPTIMISE_r({
regprop( mysv, cur);
PerlIO_printf( Perl_debug_log, "%*s%s",
EXTCONST U8 PL_varies[];
#else
EXTCONST U8 PL_varies[] = {
- BRANCH, BACK, STAR, PLUS, CURLY, CURLYX, REF, REFF, REFFL,
+ BRANCH, BACK, STAR, PLUS, CURLY, CURLYX, REF, REFF, REFFL,
WHILEM, CURLYM, CURLYN, BRANCHJ, IFTHEN, SUSPEND, CLUMP, 0
};
#endif
/* .what is a character array with one character for each member of .data
* The character describes the function of the corresponding .data item:
- * f - start-class data for regstclass optimization
+ * f - start-class data for regstclass optimization
* n - Root of op tree for (?{EVAL}) item
* o - Start op for (?{EVAL}) item
* p - Pad for (?{EVAL} item
#define DO_TRIE 1
#define TRIE_DEBUG 1
-
-#define TRIE_SIMPLE_MAX_BUFF 65536
-#define RE_TRIE_MAXBUFF "\022E_TRIE_MAXBUFF"
+#define RE_TRIE_MAXBUF_INIT 65536
+#define RE_TRIE_MAXBUF_NAME "\022E_TRIE_MAXBUF"
#define RE_DEBUG_FLAGS "\022E_DEBUG_FLAGS"
/* If you change these be sure to update ext/re/re.pm as well */