|
|
| Keep It Simple, Stupid | |
| PerlMonks |
Re^5: Why is "any" slow in this case?by LanX (Saint) |
| on Jul 28, 2025 at 14:14 UTC ( [id://11165832]=note: print w/replies, xml ) | Need Help?? |
|
> Wow, thanks. I'll refactor with this, then. please test thoroughly, I just hacked the code into my mobile as an example ... be also careful about the numbering of the captures or use an (?:...) for non-capture in the negative list. > simply generating a list of few hundred captures is slower, I can't follow, since you are using the /g modifier, each iteration will only capture 2 groups and then continue where it left of. hence my ( $c, $r ) = ( $data =~ /^(\d+) (\d+)/mg ) should nicely do. (Haven't tested the performance, but every statement normally counts) > I'll refactor You initially said that performance wasn't an issue and you were just curious. I'd rather recommend to go for the clearest code, not for the fastest. Because in the long run maintenance costs you the most.
Cheers Rolf
In Section
Seekers of Perl Wisdom
|
|
||||||||||||||||||||||||||||||||||||||||