I noticed something weird while testing a simple Perl script that\'s supposed to filter out filenames beginning with certain prefixes.
Basically, I\'m constructing a
For a long time, perl's TRIE optimization has not been applied where the initial compilation of the regex produces longjmp instead of jmp (I think) instructions (which depends on the number of alternations and the total lengths of the strings involved and what else is (earlier?) in the regex).
See the difference between:
perl -we'use re "debug"; qr/@{[join"|","a".."afhd"]}/'
and
perl -we'use re "debug"; qr/@{[join"|","a".."afhe"]}/'
You can break your alternation down into smaller chunks and precompile them separately and do e.g. (??{$rxa})|(??{$rxb})|(??{$rxc})
.