Walter Meester
HoogkarspelNetherlands
George,
>>>The statement is interpreted once and called multiple times in a FOR...NEXT iteration structure. There's no question about it.
>>
>>Not true, it's compiled once, interpretated and executed for each loop. That's the nature of P-code compile languages
>>
>Walter,
>Yeah right! Before building applications, I wanted to do systems. I did quite a bit of studying, both formally and informally. What you're saying is this: The MAX() function executes once, scanning the entire table and returns the maximum value. Even if that were true, you don't eliminate the number of comparisons required.
No, I did not say this. Read carefully. The statement in a FOR NEXT loop is interpreated and executed multiple times, while the MAX() function is interpretated onces (as a part of the SQL SELECT statement) and executed internally for each row. On what level it is executed I do not know because it is not documented.
Now of course I do not know the internals of VFP, but the interpreation process at the least reads the P-code instruction again, sets a few variables (like the last linenumber), checks various settings (e.g. for the coverage profiler, the keyboard buffer, maybe other windows messages) etc. The SQL statement is a statement that is interpretated as a whole where certain parts which contains functions and other non optimizable expressions are evaluated when neccesarry. Also do remember that MAX(), MIN(), CNT() used in a SQL Statement are not normal VFP instructions as they only operate this way in the SQL statement. Their function might be totally different from normal VFP commands.
>Further, any language developer will tell you that the difference between constants and variables is of no import. There's no difference between calling a function with a constant and calling the same function with a variable. Each iteration requires that the parameters be placed on the stack and passed to the function.
I don´t deny this.
Walter,
Previous
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only