FoxPro for Windows Performance Tips and Tricks

ID: Q117365


The information in this article applies to:


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:


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 query words: FoxWin on-line


Keywords          : FxenvConfigfp 
Version           : 2.60
Platform          : WINDOWS 
Issue type        : 

Last Reviewed: August 5, 1999