Using the Fastest Algorithm

You should determine which algorithms perform the best and have the smallest elapsed time. Tracing does not provide subsecond level of timing information. Plus, tracing imposes a higher overhead to the runtime environment, which skews the elapsed time reading.

However, you can use the %PerfTime system variable for determining elapsed time. %PerfTime retrieves the local system clock time by making a system call, and the return time is down to the millisecond.

The following example of %PerfTime determines how long a program takes to execute:

   &Start = %PerfTime;
   &results = "";
   For &I = 1 To &Count;
      &GnnwgNumber = GetNextNumberWithGapsCommit(QEORDER_DTL.QE_QTY, 999999, 1, "where QE_ORDER_NBR='GNNWG'");
      &results = &results | " : " | &GnnwgNumber;
   End-For;
   &End = %PerfTime;
   &out = "Count = " | &Count | ", total GNNWG time (s) = " | NumberToString("%6.3", Value(&End - &Start));