The three variables
$&,
$`, and
$' are known to have a performance penalty for
all regex matches in an application. TWiki is doing a lot of regexes, so these should be eliminated though it will be difficult to actually measure the effect on a single regex.
Grepping through a SVN area brought a couple of candidates (not necessarily complete since grepping for
$' had too many false positives, so I ignored it):
-
lib/TWiki/Configure/UI.pm - maybe irrelevant unless run under mod_perl
-
lib/TWiki/Configure/Types/REGEX.pm - maybe irrelevant unless run under mod_perl
-
lib/TWiki.pm - should be fixed (one line only)
-
twikiplugins/LatexModePlugin/lib/TWiki/Plugins/LatexModePlugin/Parse.pm - several occurrences. Patch suggested at TWiki:Plugins.LatexModePluginDev
, I lack any possibility to test it. (suggestion implemented - 11681.)
-
twikiplugins/NatSkinPlugin/lib/TWiki/Plugins/NatSkinPlugin/Search.pm - one line containing $&
-
twikiplugins/SectionalEditPlugin/lib/TWiki/Plugins/SectionalEditPlugin.pm - several occurrences. Too complicated for my simple brain right now.
-
twikiplugins/AliasPlugin/lib/TWiki/Plugins/AliasPlugin.pm - one line containing $&
-
twikiplugins/PerlDocPlugin/lib/TWiki/Plugins/PerlDocPlugin.pm - one line containing both $& and $`
-
twikiplugins/DBCachePlugin/lib/TWiki/Plugins/DBCachePlugin/Core.pm - two occurrences of $&
-
twikiplugins/ExternalLinkPlugin/lib/TWiki/Plugins/ExternalLinkPlugin.pm - one line containing $&
-
twikiplugins/TouchGraphPlugin/bin/tgdb - one line containing $&
-
twikiplugins/GoogleSearchPlugin/lib/TWiki/Plugins/GoogleSearchPlugin.pm - two occurrences of $&
-
twikiplugins/PhantomPlugin/lib/TWiki/Plugins/PhantomPlugin.pm - has both $` and $' Apparently untested on TWiki 4
4.1.0 released
KJL