DBF Append Speed in X# vs VO - Huge Difference
Posted: Tue Sep 15, 2020 5:11 am
Hi Dev Team!
I created a small app that collects data from a webservice and adds 100 records every 3 minutes. The file reached millions of records and the .NET app started to slow down (I thought it was freezing since there was no indication what is going behind the scene), then after extensive CPU profiling and debugging, I isolated the issue to a single function in the DBFCDX RDD.
The X# DBF DBAppend function (or dbSever Append method - also tested) is very, very slow compared the blazing speed in VO. Also, when I used the Advantage AXDBFCDX, it was very fast!
To test I created a dummy dbf with one field ( Char(20) ) and added 1 million records.
On my system, X# took 63.27 minutes while VO only took 3.86 seconds. Simpy call the DBAppend function in a loop.
Using X# public build: 2.5b
VO 2.8 - 2838
Windows 10 Pro, SSD drive.
Here is the code:
I created a small app that collects data from a webservice and adds 100 records every 3 minutes. The file reached millions of records and the .NET app started to slow down (I thought it was freezing since there was no indication what is going behind the scene), then after extensive CPU profiling and debugging, I isolated the issue to a single function in the DBFCDX RDD.
The X# DBF DBAppend function (or dbSever Append method - also tested) is very, very slow compared the blazing speed in VO. Also, when I used the Advantage AXDBFCDX, it was very fast!
To test I created a dummy dbf with one field ( Char(20) ) and added 1 million records.
On my system, X# took 63.27 minutes while VO only took 3.86 seconds. Simpy call the DBAppend function in a loop.
Using X# public build: 2.5b
VO 2.8 - 2838
Windows 10 Pro, SSD drive.
Here is the code:
Code: Select all
FUNCTION Start() AS VOID
LOCAL cDBF AS STRING
LOCAL aFields AS ARRAY
LOCAL i AS DWORD
LOCAL nStart, nElapsed AS FLOAT
RddSetDefault ( "DBFCDX" )
cDbf := "C:testmytest" // change the dbf to "C:testmytestVO" to test in VO 2.8.
FErase ( cDbf + ".cdx" )
aFields := { { "LAST" , "C" , 20 , 0 } }
DbCreate( cDBF , AFields)
DbUseArea( ,,cDBF )
nStart := Seconds()
? "start : " + ntrim(nStart)
FOR i := 1 UPTO 1000000
DbAppend()
NEXT
nElapsed := Seconds() - nStart
? "Elapsed: " + NTrim(nElapsed) + " seconds"
DbCloseArea()
wait
RETURN