[Baypiggies] Question about breaking out of a loop
Dirk Bergstrom
krid at otisbean.com
Tue Jun 7 22:06:04 CEST 2011
On 06/07/2011 12:40 PM, Hy Carrinski wrote:
> There is generator that yields tuples in a defined order into a loop
> that performs a calculation. I would like to provide an option to stop
> the calculation when the threshold is reached.
> The function in version 3 is pretty close to my current solution, but
> the functions combinations(), f() and g() are standing in for more
> computationally intensive functions.
This seems like a perfect example of premature optimization. You've got
a loop with two computationally intensive operations per cycle, and
you're worried about optimizing away a single if-equals check per cycle.
Will that single if statement really make so much difference once you
put the real (and presumably much more time consuming) functions in place?
--
--------------------------------------
Dirk Bergstrom krid at otisbean.com
http://otisbean.com/
More information about the Baypiggies
mailing list