Optimize method

Command group Flag affected Reversible Execute on client Platform(s)
Methods NO YES NO All


Optimize method


This command stores an optimized form of the method so when the method is executed for a second time it runs much faster. You should position this command so that it is the first executable statement of the method, except when you put it in a reversible block. Methods which are executed frequently, such as control methods and loops, are best optimized. The command is reversible and does not change the flag.

Optimize method works immediately, therefore when it is executed for the first time it converts all of the subsequent lines of the method being executed into its optimized form and continues execution. When the method terminates, the optimized form of that method is kept in RAM; the optimized form is executed if the method is called again. If Optimize method is in a reversible block the optimized form of the method is disposed of when the method terminates; so it will be rebuilt each time the method executes. The optimized method is also discarded whenever the design window is open for the method or the method is modified using the notation.

WARNING Optimizing too many methods will increase the memory used which may eventually result in a slowdown or worse.


; Build a list of invoices for the first overdrawn account
Optimize method
Set main file {fAccounts}
Set current list iInvoices
Define list {fInvoices}
Set search name sOverDrawn
Find first on fAccounts.Code (Use search)
While flag true
  Single file find on fInvoices.AccCode (Exact match) {fAccounts.Code}
  Add line to list
End While