FoxPro for Windows Performance Tips and TricksLast reviewed: April 30, 1996Article ID: Q117365 |
The information in this article applies to:
SUMMARYThis information is also available in FoxPro's online Help files. To go directly to this topic, choose the "Tips and Tricks" Help topic. Then do one of the following, depending on which online Help file is in use:
MORE INFORMATION
Out-of-Date IndexIf a table/.DBF operation is returning the wrong answer, try recreating the index in case the index is out-of-date. It is best to re-create an index instead of using the REINDEX command because REINDEX does not fix a damaged index file.
Rebuild .CDX FilesOccasionally rebuild .CDX files. This can reduce the .CDX file size, thereby improving performance. When recreating .CDX tags, you should first remove the tags using the DELETE TAG ALL command.
Pack Tables and Memo FilesPACK your tables periodically. This will reduce the size of the tables and improve performance. Use the PACK MEMO command to reduce size of associated memo files, especially for tables in which you frequently make changes to memo fields.
BROWSE and SCAN PerformanceTo enhance the performance of BROWSE or SCAN commands, periodically SORT tables into the most frequently used order (that is, sort into the order of the most frequently used index).
Multi-Table Query PerformanceTo enhance multi-table queries, SORT the tables by the join condition.
Optimizing QueriesQueries are optimized when the table/.DBF has no order set. Use SET ORDER TO without a tag name to remove a set order. If you have SET DELETE ON, you will need a .CDX tag on DELETED() to optimize queries for that table/.DBF.
Adding Records to a TableUse the INSERT - SQL command to add new records to a table/.DBF. This command provides better performance and greater integrity across a network than the combination of the APPEND BLANK and REPLACE commands.
Screen Input/OutputFor best performance, screen input/output in FoxPro for Windows must be carefully handled. On a typical FoxPro for MS-DOS machine with 25 rows by 80 columns, you have 2000 screen elements to refresh each time. In Microsoft Windows, the standard VGA setting is 640 x 480 pixels. This equates to over 300,000 pixels which need to be redrawn each time the screen is refreshed. Compared to a character monitor, this is about a 150:1 ratio. The SHOW GETS command is commonly used to refresh @...GETs on screen when a change is made. Using SHOW GETS can dramatically impact the performance of applications using screens with many objects or on slower machines. Instead, consider using the SHOW GET command to only refresh the @...GET being modified instead of the entire screen. In addition, FoxPro for Windows allows you to create picture buttons and check boxes by specifying a .BMP file which contains the associated picture. These types of controls take longer to refresh using SHOW GETS than normal text prompts.
Run Fewer ApplicationsReduce the number of applications running in a Windows session. Windows is a cooperative multitasking environment. The more applications you have running, the more system resources are diverted from FoxPro.
Memory VariablesUse the #DEFINE directive in FoxPro for Windows to significantly reduce the number of memory variables used in your applications, saving memory.
Wallpaper ConsiderationsIf you have limited memory, do not use wallpaper because it requires extra memory. In addition, it impacts performance whenever the screen is refreshed.
Color ConsiderationsUsing lots of colors in applications requires memory. This is especially true if you hard-code colors instead of allowing Microsoft Windows color schemes. When possible, use 16-color .BMP files because they require less disk space and display well on standard VGA monitors. Unless you need to use MS-DOS color sets for visual compatibility in cross-platform applications, you should allow users to choose their own colors using the Microsoft Windows Control Panel.
Memory AllocationFoxPro does not allocate memory for all of its resources when it is launched. FoxPro windows are allocated from the available memory pool in Microsoft Windows. Therefore, you should make enough memory available using the MEMLIMIT setting in your CONFIG.FPW file.
Memory for FoxPro for MS-DOSIf you set the KB Desired setting in the PIF file for the FoxPro for MS-DOS product to -1, Microsoft Windows will give it all the available memory. Refer to the Microsoft Windows PIF Editor help file for more information.
|
Additional reference words: FoxWin 2.60 on-line
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |