I'm investigating the speed of iterating through the string, not how it gets processed afterwards, which is why the loop bodies are all the same. So to make the benchmark be fair again, you'd have to make the same change in all the loops. I just added that bit of s/// code to provide a somewhat realistic loop body (Update: or rather, a placeholder for the actual loop body, which manipulates the $line a whole lot more and whose output is much more complex than one line of output per line of input), and as a (likely misguided) attempt to prevent for my $line (@x) { push @lines, $line; } from being optimized to @lines = @x;.
In reply to Re^4: Is foreach split Optimized?
by haukex
in thread Is foreach split Optimized? (Update: No.)
by haukex
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |