These are chat archives for lstrojny/functional-php

30th
Apr 2015
Lars Strojny
@lstrojny
Apr 30 2015 08:29 UTC
@morrisonlevi Before 5.5 the only way was a proper iterator. My benchmarks at the time showed that the overhead of the iterator actually made it often slower then the eager evaluation.
Levi Morrison
@morrisonlevi
Apr 30 2015 17:07 UTC
@lstrojny: Makes sense.
I did some simple benchmarks on it in PHP 5.5 and for small arrays the array functions were better.
I suspect because of the array optimizations in PHP 7.0 that eager array operations may be faster again ^^
Lars Strojny
@lstrojny
Apr 30 2015 17:11 UTC
Can very well be
Actually, since travis now has a PHP 7 version, I could add that for CI
Levi Morrison
@morrisonlevi
Apr 30 2015 17:12 UTC
Personally I only care that the lazy operations are fast enough, for some definition of fast enough ^^
I'm building latest master to do some checks.
Lars Strojny
@lstrojny
Apr 30 2015 17:13 UTC
Yep, let me know about your findings. Pretty interesting
Levi Morrison
@morrisonlevi
Apr 30 2015 17:53 UTC
@lstrojny Eager and lazy are roughly the same in the test I have.
(I mean by order of magnitude)
It's a pretty small array though ^^
It does a filter, then map, then reduce.
I'm not sure how to generate a larger, meaningful data set.
Levi Morrison
@morrisonlevi
Apr 30 2015 18:09 UTC
@lstrojny As expected, as the data size goes up the lazy gets closer to eager; I imagine it would surpass it eventually.
memory_get_usage() seems to be broken, but I expect the lazy version does better with memory.