dbgoto() : strange consumption of time

This forum is meant for questions and discussions about the X# language and tools
Post Reply
RolWil
Posts: 68
Joined: Mon Jul 18, 2022 3:16 am

dbgoto() : strange consumption of time

Post by RolWil »

Environment/platform: XSharp 2.14.04, VS 2021

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
User avatar
robert
Posts: 4473
Joined: Fri Aug 21, 2015 10:57 am
Location: Netherlands

Re: dbgoto() : strange consumption of time

Post by robert »

Roland,

There is no logical explanation for this.
We need to see an example

Robert
XSharp Development Team
The Netherlands
robert@xsharp.eu
Post Reply