Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Running exact piece of code alone is 7 times faster in c
Message
General information
Forum:
Visual FoxPro
Category:
Classes - VCX
Environment versions
Visual FoxPro:
VFP 9
Miscellaneous
Thread ID:
01009816
Message ID:
01011328
Views:
15
Zakaria,

I think (I don't have time to run a test now) that the speed of USED() is a function of how many tables/cursors you currently have open in the data session. I'm pretty sure the internal list is linearly searched, so more open tables increases search time.

If only these two tables are involved in the process you could move this operation to it's own data session.

But typically this sort of condition testing code should be hoisted out of the loop itself so you can do the test just once.

>My initial purpose was not to test something or compare something. I just have a class with a function that reads an input table and based on this table and some inputparameters it creates a new output table. What I wanted was to check if the input table is already "read" and the output table is already created, if so I don't have to do it again.
>
>I noticed that it took a while for checking this, my first thought it could not take so long and this was caused by the fact that I was using a class function. So thas was the reason for comparing the pieces of code.
>
>But indeed, as you said it is not an unbaised comparison. The delay is caused by calling a function in general, in fact the class function runs in this case almost as fast as a standalone function.
>
>Still then I find calling a function in a loop "very" slow. I know that I need to use this check a lot for a specific application.
df (was a 10 time MVP)

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

Click here to load this message in the networking platform