Re: Re: Generators in PHP
| From: | Lester Caine | Date: | Fri, 27 Jul 2012 14:00:00 +0000 |
| Subject: | Re: Re: Generators in PHP | ||
| References: | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-61841@lists.php.net to get a copy of this message | ||
Sherif Ramadan wrote:
https://wiki.php.net/rfc/generators#performance "You can find a small micro benchmark at https://gist.github.com/2975796. It compares several ways of iterating ranges:" What part of this discussion led you to believe such a ridiculous argument as to why generator were introduced? I'm glad to see that while seeking reason you are also demonstrating it.The micro benchmark is just that, and is not as far as I can see testing the sort of iterating process that would happen normally when going through a data set. It simply times the iterator, but does not compare like with like! The question I am asking is if USING 'xrange' to feed a feed a function and use the results is faster than 'urange' simply using the iterator to call the handling function DIRECTLY. To fix this benchmark what I am missing is how the 'yield' approach would be used to build the $result[] array. This may be obvious to some of you, but I'm missing something to help me understand just what is planned here :( -- Lester Caine - G8HFL ----------------------------- Contact - http://lsces.co.uk/wiki/?page=contact L.S.Caine Electronic Services - http://lsces.co.uk EnquirySolve - http://enquirysolve.com/ Model Engineers Digital Workshop - http://medw.co.uk Rainbow Digital Media - http://rainbowdigitalmedia.co.uk