in reply to Re^2: Impact of special variables on regex match performance
in thread Impact of special variables on regex match performance
$` The text before matching -- In your code, that's $in $' The text which comes after the match in an input string -- Alt: Lo +okarounds $& The text of the match itself -- Use captures instead
As mentioned, the cost (= slowdown) is well documented in the standard regex docs; and in many books, tutorials and nodes devoted to regular expressions.
Concerning your code: given that sub uncomment_one is never explicitly called in what you posted, you may have over-reached in your diligence to follow the guidance ( not exactly "rules ) of this forum. /me suspects that profiling what you show would be informative; certainly, as is, the slowdown using your code is largely caused by the copying which is expensive, as JavaFan points out above.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: Impact of special variables on regex match performance
by roubi (Hermit) on Dec 10, 2010 at 00:53 UTC | |
by ww (Archbishop) on Dec 10, 2010 at 03:21 UTC | |
by roubi (Hermit) on Dec 10, 2010 at 04:12 UTC |