Consultor Eletrônico



Kbase 19868: 4GL - Increase Performance When Using NUM-ENTRIES
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   20/07/2005
Status: Verified

GOAL:

If you have 4GL code that uses the NUM-ENTRIES function as a loop terminator you can greatly increase the performance of your code by removing the reference to the NUM-ENTRIES function and replacing it with a static variable.

FIX:


/* Begin Program */
DEFINE VARIABLE cData AS CHARACTER NO-UNDO.
DEFINE VARIABLE iLoop AS INTEGER NO-UNDO.
DEFINE VARIABLE iTime1 AS INTEGER NO-UNDO.
DEFINE VARIABLE iTime2 AS INTEGER NO-UNDO.
DEFINE VARIABLE iEntries AS INTEGER NO-UNDO.

/* Create String with 12,001 Bytes of Data in it */

ASSIGN cData = FILL('A,',6000) + 'A'.

MESSAGE LENGTH(cData) VIEW-AS ALERT-BOX.

ETIME(Yes).

DO iLoop = 1 to NUM-ENTRIES(cData):
END.

ASSIGN iTime1 = ETIME.

ASSIGN iEntries = NUM-ENTRIES(cData).

ETIME(Yes).

DO iLoop = 1 to iEntries:
END.

ASSIGN iTime2 = ETIME.

MESSAGE iTime1 SKIP iTime2 VIEW-AS ALERT-BOX.
/* End Program */