>Why is my program slower now than a slow PII 266?
>
>My program is using 100% of the cpu time and chewing up memory like it is going out of style.
>
>Its a .app file, run from the command window.
>
>I've used sys(3050) to limit the amount of memory avaible to vfp (limited to 40megs)
>
>The new machine is PIII 600 with 128 megs of memory.
>
>The old machine ran the process in 20 minutes, the new machine did 30% in one hour. I have to get this done today.
>
>Please help! Any advice is appreciated, I need to figure this out NOW!
>
>There were no changes of signifigance between the two runs (I had to change the program to run from local drive C to local drive D) but that was the only change.
Here is one I found (just switched from VFP 5 to VFP 6.0 SP3)
VPF 5
SELECT * ;
FROM TABLE ;
INTO CURSOR T1
(the table did not have an index on deleted())
query takes less than a second
VPF 6 SP3
SELECT * ;
FROM TABLE ;
INTO CURSOR T1
(the table did not have an index on deleted())
query takes MORE than a two minutes
fix for 6.0 SP3 - add an index on deleted()
query takes less than a second
I believe this is a fix from a bug I reported (and Microsoft reckognized) in VPF 5.0
The bug was produced by something like...
*-------------------
*program runs fine if deleted() index is not created
select * ;
from table ;
where ;
blah blah blah ;
and !deleted() ;
into cursor t1
select t1.* ;
from t1 ;
into cursor t2
*--------------------
*create an index on deleted() and program fails
select * ;
from table ;
where ;
blah blah blah ;
and !deleted() ;
into cursor t1
select t1.* ;
from t1 ;
into cursor t2
why?
Creating the index on deleted() allowed the t1 query to operate in memory, not forcing the query to be created on the physical disk drive. Until the index on deleted() was created, the t1 query was not optimized and it forced a disk presence. I have now started the practice of always including a .t. in the where condition if I need to run sub-queries on a selected cursor.
interesting experiment for VFP SP3:
table1 - has index on deleted()
table2 - no index on deleted()
select * ;
from table1 ;
into cursor t1
select t1.* ;
from t1 ;
into cursor t2
*** boom *** program fails
select * ;
from table2 ;
into cursor t1
select t1.* ;
from t1 ;
into cursor t2
*** program works fine
Hope this helps you...
Thanks,
Stacy
Black Mountain Software, Inc.