Partager via


Optimizing the Operating Environment

You can optimize Visual FoxPro performance by maximizing your computer's hardware and operating environment. The following sections describe how you can optimize these areas:

  • Maximizing Memory and Virtual Memory

  • Managing Your Hard Disk

Maximizing Memory and Virtual Memory

Providing your computer with as much memory as possible is the most effective way to optimize your system for Visual FoxPro. You can also use memory more effectively by closing all other running applications on your computer. To maximize the use of your computer's memory while running Visual FoxPro, follow these guidelines:

  • Do not run other Windows applications while running Visual FoxPro.

  • Use only those memory-resident programs needed for operation.

  • Simplify the screen display.

You can free memory by simplifying the way windows and screen backgrounds display on your computer monitor.

  • Use a color or a pattern for the desktop background instead of wallpaper.

  • Use the lowest-resolution display that is practical for you. The higher resolution of the display, the more memory your computer requires and the slower your graphics and user-interface elements appear. For VGA-compatible displays that use an extended mode driver, such as Video 7 or 8514, using the standard VGA driver ensures faster display performance but provides lower resolution and less color support.

To increase the number of applications that you can run simultaneously, Microsoft Windows supports virtual memory by swapping segments of code that is the least recently used from memory to the hard disk in the form of a paging file. As a rule, the default settings in the Windows operating system for managing virtual memory meet the requirements of most users and are the recommended settings.

Note

The paging file does not improve Visual FoxPro performance and is not a substitute for more memory.

Managing Your Hard Disk

Managing your hard disk can improve overall product speed. To get the best performance from your hard disk, provide a generous amount of disk space. If your hard disk has little free space, you can increase Visual FoxPro performance by removing unnecessary data or by purchasing a hard disk with greater capacity.

Disk input/output performance degrades significantly when a hard disk is nearly full. The more free hard disk space that is available, the more likely it is that contiguous blocks of disk space are available. Visual FoxPro uses this space for changes and additions to database, table, index, memo, and temporary files. Increasing free hard disk space improves performance of any commands that change or add to your files. More disk space also decreases the time required to read those files in response to your queries.

The way that Windows and Visual FoxPro manage files on disk can greatly affect the performance of your application. The following sections discuss managing files in directories and temporary files:

  • Managing Files in Directories

  • Managing Temporary Files

Managing Files in Directories

As a directory becomes increasingly congested with files, the operating system takes longer to find files. The speed of your system when searching directories is a factor that Visual FoxPro does not control. To improve the speed of directory searches, reduce the number of files in your directories by performing the following actions:

  • Use the Visual FoxPro Project Manager to create and manage your files, segregate program files into separate directories, and avoid creating numerous generated files.

  • When you want to distribute your application, create an application or an executable (.exe) file instead of numerous individually generated files.

    This process decreases the number of files in your application's subdirectories and increases performance.

  • If you delete a large number of files in one directory, copy the remaining files into a new directory or optimize the directory using a defragmenting utility program.

    Note

    Deleting files from a directory does not automatically speed directory searching. When a file is deleted, the file is only marked for deletion and is still included in directory searches.

  • When saving files, use short file paths to increase performance.

    For example, suppose you have a file path "C:\Program Files\Microsoft Visual FoxPro\...", which is a very long file path. Try to use shorter file paths.

Managing Temporary Files

Visual FoxPro creates temporary files for a variety of operations. For example, Visual FoxPro creates temporary files during editing, indexing, and sorting. Text editing sessions can also create a temporary or backup (.bak) copy of the edited file. By default, Visual FoxPro creates its temporary files in the same directory that Windows stores its temporary files unless you specifically designate an alternate location.

Tip

In most cases, you should specify one location for all Visual FoxPro temporary files. Make sure that the location you specify contains enough space for all possible temporary files.

For more information, see How to: Specify the Location of Temporary Files.

Searching for Temporary Files

When Visual FoxPro searches for temporary files, for example, when you use the SYS(2023) - Temporary Path function to retrieve the temporary files path or when the TMPFILES, EDITWORK, PROGWORK, and SORTWORK settings in a Visual FoxPro configuration file do not specify a different location, the Windows API GetTempPath is used to search for the path containing the temporary files. GetTempPath searches a sequence of variables that differ depending on the operating system. Microsoft Windows 2000 and later include user variables that store the location of temporary files, while Microsoft Windows 95, 98, and Me include only global system environment variables for this purpose.

On Windows 2000 and later, GetTempPath, and therefore, SYS(2023), TMPFILES, EDITWORK, PROGWORK, and SORTWORK, searches the TMP user variable for the location of temporary files by default. If the TMP user variable does not specify a location, Visual FoxPro searches the following variables in a specific order:

  • TMP system variable.

  • TEMP user variable.

  • TEMP system variable.

If these variables do not specify a location, the location for storing temporary files defaults to the home drive and path, or the Temp folder in the user's Documents and Settings directory.

Note

If more than one value is specified for TMP or TEMP, then the first value is used.

On Windows 95, 98, and Me, GetTempPath searches the TMP and TEMP global system variables in that order and then searches the current directory.

For more information, see SYS(2023) - Temporary Path and Special Terms for Configuration Files.

See Also

Concepts

Optimizing Visual FoxPro in a Multiuser Environment

Optimizing Visual FoxPro Startup Speed

Other Resources

Optimizing Your System