in reply to Re: The Virtue of Laziness
in thread The Virtue of Laziness

I doubt that a for ("a",@ar,"z") {} is still that performant, because the heuristics might not detect anymore the array in between

LanX, you are right:

cmpthese(0, { map => sub {map_die(\@arr)}, for => sub {for_die(\@arr)}, }); sub map_die ($ar) { eval {map {die} 0, @$ar}; } sub for_die ($ar) { eval { for (0, @$ar) { die; } } } __DATA__ Rate for map for 1390/s -- -1% map 1404/s 1% --

Greetings,
🐻

$gryYup$d0ylprbpriprrYpkJl2xyl~rzg??P~5lp2hyl0p$

Replies are listed 'Best First'.
Re^3: The Virtue of Laziness
by LanX (Saint) on May 05, 2024 at 10:14 UTC
    Well, you could ask p5p if it's possible to catch the edge cases of iterating over a following array variable
    • map {} @array
    • grep {} @array

    But, I'm sceptical they have resource left for that.

    Cheers Rolf
    (addicted to the Perl Programming Language :)
    see Wikisyntax for the Monastery