Topic : GFA-Basic Editor Author : Lonny Pursell Version : GBE.HYP v3.74 (12/31/2023) Subject : Programming/Documentation Nodes : 171 Index Size : 4296 HCP-Version : 3 Compiled on : Atari @charset : atarist @lang : @default : Default @help : STG Help @options : +g -i -s +z @width : 75 @hostname : THING @hostname : STRNGSRV @hostname : HIGHWIRE @hostname : CAB View Ref-FileThis option will optimize a specified subroutine by converting all LOCALs to Globals. This can be used to optimize time critical code. Every local added to a subroutine impacts it's preformance. Locals are allocated on the fly in GFA's free memory pool. It also adds 2 additional instructions, one on the way into the subroutine for setup and another on the way out to deallocate them. Thus the formula: Total extra instructions: 2+(total_locals*2) Global variables used in a subroutine however do not cause any additional overhead or preformance loss. This option works by generating unique global variable names for a specified subroutine and converting the LOCAL command into a CLR command. The CLR command simulates the auto clearing of local variables. Examples: REM #LG@ test !optimize this procedure REM #LG@ test% !optimize this numerical function REM #LG@ test$ !optimize this string function The precent '%' and dolloar '$' symbols must be used, because GFA allows subroutines of different types with the same name. This option can handle a maximum of 128 locals. Exceeding this limit will halt the operation and display an error message. Subroutines over this limit can't be optimized and the meta command must be removed to continue. Of cource one could code everything with global variables by hand. However, this makes for some messy looking code! I don't recommend coding that way. With this option you can write clean readable code with locals and still take advantage of the speed global variables offer where needed. Warning: This option will not work with recursive subroutines. Subroutines which call themselves. DEFFN subroutines cannot be optimized. Note: Internally GBE generates unique global variable names using this format: Lxxx - where xxx is a hex value Examples: LB020&,LB110%,LE082$,LF083| If one would happen to redefine such a global variable by accident it will cause unpredictable problems. If you use this option, please avoid naming any variables in this manner.