The calculation is done only once in the beginning of the loop.
/Emil
2012/2/23 Kevin Fishburne kevinfishbu...@eightvirtues.com
If the ranges of a For...Next loop require calculations, are they slower
than a loop which doesn't? In other words, is the first example below
faster than the
Kevin,
As far as I found out, it is done only once at the beginning. Just make
a test: set a stop point before the loop, and than make single steps
through the loop watching the local variables.
I use this for getting clear about efficiency from time to time, and I
found it a pretty
Gambas is open source, so you can always look in the source code how
everything is implemented. e.g. look in gbx_exec_loop.c and look for
jump_next.
/Emil
2012/2/23 Rolf-Werner Eilert eilert-sprac...@t-online.de
Kevin,
As far as I found out, it is done only once at the beginning. Just make
Thank you everyone, that information is extremely useful. You can also
time several repetitions of the code and compare the results. It seems
declaration and pre computation of variables involved in a For...Next
loop isn't necessary other than for legibility, which is awesome.
--
Kevin
Nested loops are of course different thing...
Jussi
On Thu, Feb 23, 2012 at 12:31, Kevin Fishburne
kevinfishbu...@eightvirtues.com wrote:
Thank you everyone, that information is extremely useful. You can also
time several repetitions of the code and compare the results. It seems
If the ranges of a For...Next loop require calculations, are they slower
than a loop which doesn't? In other words, is the first example below
faster than the second?
For Counter = 1 To 100
Next
For Counter = 100 / 100 + 1 - 1 To 100 / 100 + 1 - 1 + 99
Next
Does it make any difference if the