Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Coding Standards
Message
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00115272
Message ID:
00116232
Views:
28
>>2) WHILE, 8.60 seconds
>>3) FOR with EXIT condition if nloopvar = 1,000,000 (so it will check in all iterations), 6.15 seconds

>Nice job, but I think that this underscores what I was getting at. Let's say that you've got an iteration structure that has to make a 1,000 iterations or less. Let's further assume the results you've posted (2 and 3, that is) are indicative of the performance. This means that there's going to be a maximum of about 2.5/1000 of a second difference. Assuming (there's that word again :-)) this, and given the choice between FOR and DO WHILE, I'd choose the latter for purposes of readability if the number of iterations aren't fixed and a conditional exit is required.
>
>That's just me, however. In my situation (unlike yours) I almost never (never, say never) have such a high number of iterations that it becomes a factor.

Yes, for short duration loops, I guess so, with seconds, who cares?...but we're talking, what, a 28% speed improvement, so that if you have either a large number of iterations and/or lots of processing, that 28% or so might come in handy...in my case, we're talking about hours :)
The Anonymous Bureaucrat,
and frankly, quite content not to be
a member of either major US political party.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform