Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Fox Slow ? with CDX
Message
From
11/08/2007 12:53:17
Dragan Nedeljkovich (Online)
Now officially retired
Zrenjanin, Serbia
 
 
To
11/08/2007 12:15:56
Mike Yearwood
Toronto, Ontario, Canada
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 6 SP5
Miscellaneous
Thread ID:
01247603
Message ID:
01247636
Views:
22
>Suhas
>
>I tried all of your code on a file I keep around for testing. It has 5.25 Million records. Your first code took 102.553 seconds. The second took 107.589 and the third took 104.452.
>
>Try this instead:
>
>Clear all set relations etc.
>
>Build this tag, once and plan to reuse it.
>
>INDEX ON SYMBOL + ',' + DTOS(DATE) TAG SYDT
>
>Then see if this is fast enough:
>
>
Select bhav_data
>set order to tag sydt
>scan
>  m.lcsy = symbol + ','
>  copy to array aopen while symbol + ',' = m.lcsy
>endscan
>
>
>It took 30.149 seconds on my file ;)

One trouble with copy-while inside a scan/endscan loop is that you'll miss the first record of every symbol value except the first, because after copy-while you land of the first record for which the while condition returns .f., and then endscan does one more skip. Compare the lengths of arrays you get your way against what you get like this
Select bhav_data
set order to tag sydt
locate
do while not eof()
  m.lcsy = symbol + ','
  copy to array aopen while symbol + ',' = m.lcsy
enddo
and then see whether the total length of arrays matches reccount().

Of course, the other trouble is that even so, nothing is done with the array inside the loop, so we're doing all of this for nothing, except for the last value of bhav_data.symbol :).

back to same old

the first online autobiography, unfinished by design
What, me reckless? I'm full of recks!
Balkans, eh? Count them.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform