Avoid CALLs to gain speed

Unfortunately, most Pick systems provide very slow implementations of BASIC's CALL statement. It's not unusual for a CALL to be ten times slower than a GOSUB! That means that an application program that uses B-TREE-P is often spending its time in a CALL statement trying to transfer control to a B-TREE-P subroutine.

B-TREE-P depends on CALL statements in order to provide a convenient and well-structured interface that is easy to understand and invoke from existing application programs. But by using GOSUBs instead of CALLs, you can make B-TREE-P run much faster. The disadvantages are (1) the B-TREE-P source code must be included in every application instead of separately compiled (some compilers offer INCLUDE statements to help do this), (2) variables used as arguments by B-TREE-P subroutines must be initialized with assignment statements before the GOSUB that replaces the CALL, and (3) variable names used and modified by B-TREE-P must not be the same as variable names in the application.

If you decide you need to squeeze more speed out of B-TREE-P, try replacing CALLs with GOSUBs before you try anything else. You'll probably see such a surprising improvement that you won't have to do anything more. The BUILD utility is a convenient place to test the replacement of CALLs with GOSUBs, since the calling program is so short and simple, and since BUILD typically has to run for a significant amount of time all at once (so the savings by avoiding CALLs will be substantial). Using GOSUBs instead of CALLs to invoke BTPKEY from BTPINS and BTPDEL is another convenient way to quickly and easily speed up B-TREE-P.