Subject: | Use of $& slows down all programs using DateTime::Format::Duration |
DateTime::Format::Duration line 597:
croak("Unknown symbols in parse: $&") if $field_list=~/(\%\w)/g;
(I'm pretty sure the /g flag is wrong here, but that's not the point.)
This line uses the special variable $& which slows down all regex matches in all programs that (directly or indirectly) use this module. See http://perldoc.perl.org/perlvar.html#$MATCH for details.
Simply changing $& to $1 in that line improved the runtime of a particularly regex-heavy program from 23s down to 15s.
It would be good if you could make that change to the official release on CPAN.