Re: Use of generators and efficiency

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Tim Chase

    Re: Use of generators and efficiency

    To my great surprise, this approach was often considerably _slower_ to
    complete than the original program (up to ~40% depending on which modifiers
    were used), despite producing initial results more quickly.
    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



Working...