Hello, I’m also wondering when I see code examples in the RFC like:
$profit = [1, 4, 5] |> loadMany(...) |> fn(array $records) => array_map(makeWidget(...), $records) |> fn(array $ws) => array_filter(isOnSale(...), $ws) |> fn(array $ws) => array_map(sellWidget(...), $ws) |> array_sum(...); This would be way better on performances as a single foreach, no? I feel like this pipe operator encourages coders to use array_* functions with closures, which is often terrible performances compared to a loop. How would the performance of the above compare with: $profit = 0; foreach (loadMany($input) as $item) { $widget = makeWidget($item); if (!isOnSale($widget)) { continue; } $profit += sellWidget($widget); } Côme
signature.asc
Description: This is a digitally signed message part.