-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Benchmarks for \Pipeline\Simple #2
base: master
Are you sure you want to change the base?
Conversation
… optimized benchmarks.
…benchmark.php 10000
While Simple/Pipeline solves the same basic problem of PHP's array functions having horrible API, it's very barebones, so it doesn't have a place in the comparison of full LINQ implementations. Of course, most LINQ functions can be implemented through map-reduce, which your library seems to cover, but many examples become too verbose or plain impossible (like sorting or transforming keys). I'll leave the pull request open though, so that if anyone is interested they can check it out. Your benchmark results are kinda weird. YaLinqo's string lambdas are in most cases faster than anonymous functions in the same YaLinqo tests, which can never happen. As for the tests in which your library performes better, there're clear reasons for this. In case of "Generating lookup of 100 floats, calculate sum", you just skip some transformations which can't be implemented with Simple/Pipeline (it works only with values, not keys), this is the reason it's faster. In case of "Aggregating arrays", you only have the optimized version which skips 3/4 of calculations. Now that I think about it, I should just remove the array-optimized case, as it skews the results of the whole test group. |
Frankly, I was thinking of my task at hand: Simple/Pipeline need some sort of performance review, and if you would accept this PR I would just link to this repository and be done with it. Else I would have to write my own benchmarks. Is there anything that can change you mind? In what PHP version were you testing? I used Debian’s stock PHP 7.0. |
@sanmai My requirements are:
Both requirements are beyond the scope of your library, if I understand correctly. Anyway, I don't see anything wrong with pointing your users to your fork of my becnchmark project. I'm unlikely to update the project beyond updating dependencies, unless some major things happen to PHP which considerably affect the performance. And you're unlikely to expand your library much beyond what you already have. Overall, both can be considered static. Now, if I understood the aim of your project incorrectly and you actually plan to implement a comprehensive "collection pipeline", not just basic map-reduce functionality, then feel free to ping me when you expand your library. The latest run looks to be on PHP 5.5 on Windows. Oh well, I guess it needs updating then. PHP 7.0 severely affected the performance. |
There you go - now with a fancy new LazyLINQ.
PHP 7.0 is reaching EOL later this year, so I'd say you're a little late to the party with your PHP 5.5. Also I added a valid |
Ping @Athari. You mind anything against last update? You wanted a more-less comprehensive LINQ port, and here you have it. |
Benchmarks for
\Pipeline\Simple
, for a plain generators, and additional improvements.It can be seen that generators are usually five times slower than plain arrays.
On my fairly old machine I get this:
On some cases
\Pipeline\Simple
beatsYaLinqo
but I'd only take it as a pleasant surprise: it wasn't intended for plain arrays processing.