in reply to Re^4: Why is "any" slow in this case?
in thread Why is "any" slow in this case?
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
(addicted to the Perl Programming Language :)
see Wikisyntax for the Monastery
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^6: Why is "any" slow in this case?
by ysth (Canon) on Jul 28, 2025 at 16:17 UTC | |
Re^6: Why is "any" slow in this case?
by Anonymous Monk on Jul 28, 2025 at 20:20 UTC | |
by LanX (Saint) on Jul 30, 2025 at 21:41 UTC | |
Re^6: Why is "any" slow in this case?
by LanX (Saint) on Jul 30, 2025 at 22:18 UTC |