Closed drupol closed 6 years ago
Won't flatten1()
break if any of the inputs is a Traversable
, which is correctly handled by the current implementation?
I will check.
You're perfectly right, see the example: https://3v4l.org/3db8j
I guess I will close this issue :-)
I've updated the example, it now works with a Traversable as well... and it's most of the time a bit faster.
Link: https://3v4l.org/VFV2h
I've updated the example, it now works with a Traversable as well... and it's most of the time a bit faster.
Except that you're incorrectly typecasting $input
into array
instead of using the proper iterator_to_array()
function. Anyway "most of the time a bit faster" doesn't really justify a PR IMHO :)
That's true :-) Thanks for the tips.
Hello,
I've run a benchmark on
Functional\flatten()
. I wanted to compare it to the function I'm using to flatten an array.Find the benchmark here: https://3v4l.org/cXDe6
As I can see, the first method (
flatten1()
) is a bit faster in almost every cases.Let me know if you would be interested to have a PR and include it.
Thanks!