Is str ~ regex the root of all evil, or the leaf of all good?
bearophile
bearophileHUGS at lycos.com
Fri Feb 20 01:57:02 PST 2009
Benji Smith:
> It's a very simple transformation, increases speed (dramatically) for
> complex regular expressions (especially those produced dynamically at
> runtime by combining large sets of unrelated target expressions), and it
> reliably produces equivalent results with the inefficient version.
See:
http://search.cpan.org/~dankogai/Regexp-Optimizer-0.15/lib/Regexp/List.pm
http://search.cpan.org/~dankogai/Regexp-Optimizer-0.15/lib/Regexp/Optimizer.pm
Something like that can be implemented as small pre-processing layer over the re module.
Bye,
bearophile
More information about the Digitalmars-d
mailing list