Closed marc-mabe closed 7 years ago
The change does look good to me. The performance difference is obvious, the generator version returns an iterator, that did nothing yet, you have to loop through all the values in order to see a difference in performance.
I suggest you loop through all the values in your benchmark, and then we compare again, but I assume generators would use less memory and take more time.
... the generator version returns an iterator, that did nothing yet ...
Yea you are totally right - thx
Now tried it by iterate over the items in bench.
The result is exactly as you suggested: the generator is a bit slower in all cases (except empty list) but needs very little less memory. -> As such lists are limited by the number of defined enumerators anyway there is no need for generators.
But it was a try ;)
@prolic please can you have a look - I just tested if it makes sense to use generators but this performance speed-up must be wrong but all tests passed: