Pathologically Eclectic Rubbish Lister | |
PerlMonks |
Re^2: An optimization of last resort: eliminate capturing from your regexpsby Aristotle (Chancellor) |
on Jul 24, 2006 at 22:04 UTC ( [id://563396]=note: print w/replies, xml ) | Need Help?? |
If a pattern doesn’t contain (?{}) or (??{}) bits, then $str cannot change during a match. So in that case it would be feasible to postpone the memcpy until right after the match (before the regex engine returns) and memcpy only the matched bits. That way, all regexen which don’t run Perl code would automatically avoid unnecessary copying. I think that would be a worthwhile patch. Makeshifts last the longest.
In Section
Meditations
|
|