Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
COPY TO ARRAY against a cursor?
Message
From
07/08/2019 15:57:31
John Ryan
Captain-Cooker Appreciation Society
Taumata Whakatangi ..., New Zealand
 
 
To
07/08/2019 09:10:34
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
01669872
Message ID:
01669969
Views:
82
>>PS: For cursor test, you should include NOFILTER for a true cursor ...

Generally agree, though a filtered cursor in context isn't a bad comparison.

>>and remove "release aFrance..." which explicitly makes it lose more time for no reason. And you should include Local array declaration. That is what one normally want to do in real world app.

I commented out LOCAL aFranceEmps[1] because COPY TO ARRAY does not increase the size of the Array if it already exists. So in this case, COPY TO ARRAY would populate only one array element first time. Put a breakpoint after COPY TO ARRAY to confirm. If you put LOCAL aFranceEmps[1] back and comment out the RELEASE aFranceEmps , now Copy to Array populates only one element every time. So not a fair test:

Using COPY TO ARRAY, 10000 passes took 0.024; records in result = 1
Using SQL SELECT, 10000 passes took 0.518; records in result = 12
Using SQL SELECT to cursor, 10000 passes took 0.517; records in result = 12

Another reason I had for Release aFranceEmps is that in real use, COPY TO ARRAY can't rely on an existing array of the exact correct dimensions and size to reuse every time, which is what this test would give it.

Experimenting with and without RELEASE, I saw very little difference- COPY TO ARRAY a few hundredths of a second quicker without RELEASE, SELECT about the same.
"... They ne'er cared for us
yet: suffer us to famish, and their store-houses
crammed with grain; make edicts for usury, to
support usurers; repeal daily any wholesome act
established against the rich, and provide more
piercing statutes daily, to chain up and restrain
the poor. If the wars eat us not up, they will; and
there's all the love they bear us.
"
-- Shakespeare: Coriolanus, Act 1, scene 1
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform