How can I speed up the execution (loading) of Statistica Visual Basic programs by removing unnecessary references (type libraries)?
When you create Statistica Visual Basic programs, either by recording a macro from an interactive analysis or by selecting New from the File menu, then by default the new program is initialized so that it can automatically use all of the procedures (Statistical analysis routines, graphics routines) of your Statistica installation. Thus, you can access the complete functionality of all Statistica libraries in the new program. However, most if not all (completed) Statistica Visual Basic programs will only use a small portion of that functionality, and by removing the support for functions that are not needed, the execution of the program, or more specifically, the time required to load and initialize the program, can sometimes be speeded up significantly. Therefore, when designing programs for routine use, or for distribution, it is recommended to remove the references to Statistica libraries that are not required for the program's operation.
- Removing unnecessary references
- The functionality of Statistica is organized into several reference (or type) libraries that contain the functions, variables, etc. for the respective routines. You can review the reference libraries loaded for a current Statistica Visual Basic program (displayed in the program editor, see
SVB Overview) by selecting
References from the Tools menu. Since most programs will only use a very small portion of the complete Statistica Visual Basic functionality, you can "unload" the unnecessary (unused) libraries by deselecting them in the
References dialog box (clear the respective check boxes). Note that you can also change the default libraries that are loaded whenever you create a new program (on the Macros (SVB) Programs tab of the Options dialog - click the Edit button under Type Library References).
In most cases, the reference libraries required to execute a particular program are fairly obvious: If you use functions from the Graphics library, then that library will be required for the program to execute properly. If you happen to make a mistake, and accidentally remove the reference for a required library, then the program will simply not run, and usually report an invalid property, method, or type of object in the place where a particular function call etc. was unresolved.
Technical note: How type library references are stored in .svb and .svx files. In some cases you may want to directly remove certain or all type libraries from a Statistica Visual Basic program without going through the References dialog. The actual references to the different Statistica type libraries are stored at the beginning of each .svb or .svx file. If you open such files as text files in a standard word processor or text editor, you will see references such as this:
'#Reference {C9E5900E-3D45-11D4-9FF4-00C04FA0D540}#1.0#0#
'#Reference {C9E59002-3D45-11D4-9FF4-00C04FA0D540}#1.0#0#
These codes are the unique ID numbers that identify each type library in your system. The Statistical significance tests are produced via the Wald statistic, a Likelihood ratio test, or score statistic. Visual Basic editor (see SVB Overview) will not show these lines (of code), but instead interpret them as instructions to load the respective libraries. Consult Microsoft system programming documentation for further details regarding these ID's, and advanced programmers can remove or add these ID's directly via a text editor, although this would not be the recommended procedures as it is more error prone.