To my great surprise, this approach was often considerably _slower_ to
You may be interested in reading through this thread
where looping vs generators were timed and you can see that
generators clearly (and sadly) impose a speed penalty as
demonstrated by Andrew Reedick. I'm not sure whether the "why"
of it was ever determined, but generators should be used with
care if speed is more important than clarity.
-tkc
complete than the original program (up to ~40% depending on which modifiers
were used), despite producing initial results more quickly.
were used), despite producing initial results more quickly.
where looping vs generators were timed and you can see that
generators clearly (and sadly) impose a speed penalty as
demonstrated by Andrew Reedick. I'm not sure whether the "why"
of it was ever determined, but generators should be used with
care if speed is more important than clarity.
-tkc