Hi friends, I have another strange issue.
My converted code (Harbour –> XSharp) takes many times longer than the original Harbor code. I narrowed the issue down to a single line of code and that is a “dbgoto()” statement.
I have an array (“sa_pm”) that is loaded with some fields from table “BFPM”, and also the record number.
Process:
I loop through the array, copy the record number from the array into var “nTemp” and then use “nTemp” in a dbgoto(). This single line takes up about 83% of the total time consumed for the process.
However, if I use a fixed number such as “dbgoto(300)” or even a calculated variable (“dbgoto(nX*200)”) as in the example below, the total time shrinks to 4.6%(!)
Code: Select all
LOCAL nTemp := 0 AS DWORD
...
...
nTemp := sa_pm[nX,mc_bfpm_recno] // Get record number from array of stored records
if nTemp#0 // "nTemp" Can't really be zero, but just to be sure ...
FU_TIME_TRACK("fu_pm_adp",.t.) // Start timer
bfpm->(dbgoto(nTemp)) // uses 83% of total processing time
// bfpm->(dbgoto(nX*200)) // uses 4.6% of total processing time. Note using "nX * 200" simply to create a "random" record number
FU_TIME_TRACK("fu_pm_adp",.f.) // End timer
endif
...
...
As always, thanks for your help!
Roland