>>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