TITLE:Back-to-Basics: FlashBASIC

ISSUE:Multi-Value Solutions Dec'98

AUTHOR:Nathan Rector

COMPANY:Natec Systems

EMAIL:nater@northcoast.com

HTTP:www.northcoast.com/~nater/

FlashBASIC is a compiler used to create C code from Pick/BASIC source code creating better proformance. This FlashBASIC code may subsequently be run in the Pick environment in the same manner as a regular Pick/BASIC program with the exception that FlashBASIC code runs significantly faster.

The "o" option with the "compile" or "basic" verbs invokes FlashBASIC. When complete, the native code produced is appended to the standard interpreted object code. Because FlashBASIC generates machine-specific code, such code must be recompiled when moved to a different platform. Furthermore, FlashBASIC code cannot call interpreted code, or vice-versa. In other words, if a mainline program is compiled with the "o" option, all of its subroutines or "entered" modules must also be created as FlashBASIC.

Choosing a FlashBASIC Level:

The "o" option may be followed by a number, from 1 to 9, which indicates the FlashBASIC (optimization) "level". If not specified, the level defaults to 1, which gives a large performance increase while minimizing compile time and object size. Higher levels increase object size by as much as 100% over that achieved with level 1, and increase compile time exponentially. Furthermore, levels above 1 yield relatively small performance increases for most applications. High levels also tend to use very large amounts of Unix or NT swap space. If the system runs out of swap space, FlashBASIC retries with a lower level. Line numbers (for error messages) and the state of variables within the debugger are also not guaranteed when using a level greater than one. Finally, the exact behavior of a specific level above one is undefined and may be different on different platforms or releases.

Pick Systems advises running routines with various levels to see if the run-time performance increase is worth the compile-time and object-size trade-offs. The best candidates for higher levels are small modules (less than about 200 lines) which have little or no string manipulation and lack significant amounts of screen or disk I/O. Using a level of 9 can cut in half such programs' run time as compared to their speed at level one, while not taking an unreasonably long time to compile.

Producing FlashBASIC without source:

FlashBASIC may be used on an application lacking source code by using the "w" option when compiling (see "compile" for specific instructions.) Therefore, an applications vendor need not ship source code or even a new version of the object code. Customers equipped with FlashBASIC can compile their current applications "as-is". However, it is suggested that future applications be shipped with a Pick/BASIC program, PROC, or macro, that automatically produces the FlashBASIC code at the customers site.

Shipping FlashBASIC code is only recommended when a vendor wishes the code to run on a single platform, and when media size is not an issue.

Compiler Options for use with FlashBASIC:

b Array bounds checking is off by default with FlashBASIC. (It is always generated in the interpreter.) Using the "b" option while compiling adds this feature to the FlashBASIC code, but increases compile time by about 20%, and slows down run-time array accesses.

c Eliminates EOL's (end-of-lines) in both FlashBASIC and interpreted code. Using this with FlashBASIC decreases compile time by 20%, and decreases run-time slightly. However, this prevents the ability to single-step in the debugger.

f Uses floating point arithmetic

h By default, the FlashBASIC compiler attempts to create native code that can be shared by all users. Using the "h" option forces the module to be loaded locally, and is typically used for modules that will be used by only one or two people at any given time.

k This option, when used without the "h" option, forces shared code to remain loaded until the machine is shut down. This option should be used for programs needed by most users of the system. It reduces memory usage and load time drastically when applied to multi-user situations. See the "shpstat" program for monitoring the status of shared programs.

o Triggers the FlashBASIC compiler.

w This option is used when producing FlashBASIC code without source.

TITLE:Back-to-Basics: FlashBASIC

TITLE:Back-to-Basics: FlashBASIC

ISSUE:Multi-Value Solutions Dec'98

AUTHOR:Nathan Rector

COMPANY:Natec Systems

EMAIL:nater@northcoast.com

HTTP:www.northcoast.com/~nater/

FlashBASIC is a compiler used to create C code from Pick/BASIC source code creating better proformance. This FlashBASIC code may subsequently be run in the Pick environment in the same manner as a regular Pick/BASIC program with the exception that FlashBASIC code runs significantly faster.

The "o" option with the "compile" or "basic" verbs invokes FlashBASIC. When complete, the native code produced is appended to the standard interpreted object code. Because FlashBASIC generates machine-specific code, such code must be recompiled when moved to a different platform. Furthermore, FlashBASIC code cannot call interpreted code, or vice-versa. In other words, if a mainline program is compiled with the "o" option, all of its subroutines or "entered" modules must also be created as FlashBASIC.

Choosing a FlashBASIC Level:

The "o" option may be followed by a number, from 1 to 9, which indicates the FlashBASIC (optimization) "level". If not specified, the level defaults to 1, which gives a large performance increase while minimizing compile time and object size. Higher levels increase object size by as much as 100% over that achieved with level 1, and increase compile time exponentially. Furthermore, levels above 1 yield relatively small performance increases for most applications. High levels also tend to use very large amounts of Unix or NT swap space. If the system runs out of swap space, FlashBASIC retries with a lower level. Line numbers (for error messages) and the state of variables within the debugger are also not guaranteed when using a level greater than one. Finally, the exact behavior of a specific level above one is undefined and may be different on different platforms or releases.

Pick Systems advises running routines with various levels to see if the run-time performance increase is worth the compile-time and object-size trade-offs. The best candidates for higher levels are small modules (less than about 200 lines) which have little or no string manipulation and lack significant amounts of screen or disk I/O. Using a level of 9 can cut in half such programs' run time as compared to their speed at level one, while not taking an unreasonably long time to compile.

Producing FlashBASIC without source:

FlashBASIC may be used on an application lacking source code by using the "w" option when compiling (see "compile" for specific instructions.) Therefore, an applications vendor need not ship source code or even a new version of the object code. Customers equipped with FlashBASIC can compile their current applications "as-is". However, it is suggested that future applications be shipped with a Pick/BASIC program, PROC, or macro, that automatically produces the FlashBASIC code at the customers site.

Shipping FlashBASIC code is only recommended when a vendor wishes the code to run on a single platform, and when media size is not an issue.

Compiler Options for use with FlashBASIC:

b Array bounds checking is off by default with FlashBASIC. (It is always generated in the interpreter.) Using the "b" option while compiling adds this feature to the FlashBASIC code, but increases compile time by about 20%, and slows down run-time array accesses.

c Eliminates EOL's (end-of-lines) in both FlashBASIC and interpreted code. Using this with FlashBASIC decreases compile time by 20%, and decreases run-time slightly. However, this prevents the ability to single-step in the debugger.

f Uses floating point arithmetic

h By default, the FlashBASIC compiler attempts to create native code that can be shared by all users. Using the "h" option forces the module to be loaded locally, and is typically used for modules that will be used by only one or two people at any given time.

k This option, when used without the "h" option, forces shared code to remain loaded until the machine is shut down. This option should be used for programs needed by most users of the system. It reduces memory usage and load time drastically when applied to multi-user situations. See the "shpstat" program for monitoring the status of shared programs.

o Triggers the FlashBASIC compiler.

w This option is used when producing FlashBASIC code without source.