FoxPro for Windows Performance Tips and Tricks

Last reviewed: April 30, 1996
Article ID: Q117365
The information in this article applies to:
  • Microsoft FoxPro for Windows, version 2.6

SUMMARY

This 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:

  • FOXHELP.HLP: Choose the "Performance Tips" jump text.
  • FOXHELP.DBF: Scroll to the "Performance Tips" heading.

MORE INFORMATION

Out-of-Date Index

If 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 Files

Occasionally 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 Files

PACK 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 Performance

To 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 Performance

To enhance multi-table queries, SORT the tables by the join condition.

Optimizing Queries

Queries 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 Table

Use 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/Output

For 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 Applications

Reduce 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 Variables

Use the #DEFINE directive in FoxPro for Windows to significantly reduce the number of memory variables used in your applications, saving memory.

Wallpaper Considerations

If you have limited memory, do not use wallpaper because it requires extra memory. In addition, it impacts performance whenever the screen is refreshed.

Color Considerations

Using 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 Allocation

FoxPro 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-DOS

If 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
KBCategory: kbprg
KBSubcategory: FxenvConfigfp


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: April 30, 1996
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.