Page 1 of 1

RDML Code benchmarking

Posted: Thu Jun 08, 2023 12:07 am
by sotis
Hello,

is it possible somehow to benchmark my RDML code to find out if a code optimization worked?

eg. the following pseudocode when GetTicks gives the time, say in millisecond accuracy.

GetTicks1
Execute Code
GetTicks2

DIFF = GetTick2 - GetTicks1
Display(#DIFF)

best,
Sotiris

Re: RDML Code benchmarking

Posted: Thu Jun 08, 2023 3:50 am
by Dino
depending on how small or large, you could just use the time as seconds.

Code: Select all

Define Field(#starttime) Reffld(#timex)
Define Field(#endtime) Reffld(#timex)
Define Field(#diff) Type(*DEC) Length(15) Decimals(0)

#starttime := #timex.Now

Begin_Loop To(10000)
Select Fields(*ALL) From_File(pslmst)
Endselect
End_Loop

#endtime := #timex.Now
#diff := #endtime.AsSeconds - #starttime.AsSeconds
other post about date difference here:
viewtopic.php?f=3&t=2652&p=7898&hilit=d ... ence#p7898

notice that datetimex can have miliseconds, but then you have to make the routine for the difference of those. I think the current routine is in seconds.

Re: RDML Code benchmarking

Posted: Thu Jun 08, 2023 4:25 am
by Dino
This can give you difference in miliseconds:

Code: Select all

Define Field(#starttime) Reffld(#datetimex)
Define Field(#endtime) Reffld(#datetimex)
Define Field(#diff) Type(*DEC) Length(10) Decimals(0)

#starttime := #datetimex.Now
Begin_Loop To(100)
Select Fields(*ALL) From_File(pslmst)
Endselect
End_Loop
#endtime := #datetimex.Now
#diff := (#endtime.AsSeconds - #starttime.AsSeconds) * 1000