Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Bug on timer, but not deterministic
Message
 
 
To
24/10/2003 11:42:22
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00840948
Message ID:
00842227
Views:
25
Fabio,

>Why you have skip the last point ?

You mean the code you posted showing that calling DOEVENTS takes 0 time?

I didn't respond to that because it's physically impossible. Executing a line of code in VFP always takes time. Executing a line of code in any computer language always takes time. Even a NOP instruction takes time. Your "test" code is simply incapable of measuring the amount of time it takes.

For you to think that executing a line of code takes 0 time pretty much explains the futility of trying to convince you otherwise.

If a 0 time instruction were possible, and generate a useful result, then a 0 hz computer could operate as fast as a 2.4 ghz computer. Intel, IBM and Motorola would be out of business and we'd all have infinitely small computers with infinite computation capacity.

VFP does not do things like invariant code hoisting or loop unrolling that C/C++ optimizers are capable of. If a C++ compiler had determined that your DOEVENTS call was invariant, which it is not, but it could wrongly assume this it would have emitted code like this:
tzz = seconds()
doevents
i = 1100001
? seconds() - tzz
completely eliminating the loop, and making it run much faster.

These optimizations can in some cases be quite incorrect and are the reasons for #PRAGMAs to exist to turn them off, because C/C++ compilers are not the all-knowing things that they sometimes think they are.
df (was a 10 time MVP)

df FoxPro website
FoxPro Wiki site online, editable knowledgebase
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform