Share via


Optimizing the Operating Environment

An effective way to optimize Visual FoxPro performance is to get the best use of your computer's hardware and environment. This section addresses how to use memory effectively and how to get the best performance from your hard disk.

Using Memory and Virtual Memory Effectively

The most effective way to optimize your system for Visual FoxPro is to provide it with as much memory as possible. Visual FoxPro can take advantage of enormous amounts of computer memory. As well as providing memory, you can optimize the performance of Visual FoxPro by closing all other running applications on your computer.

To get the best use of your computer's memory while running Visual FoxPro, follow these guidelines:

  • Do not run any other Windows applications while Visual FoxPro is running.
  • Use only those memory-resident programs needed for operation.

To increase the number of applications that you can run simultaneously, Microsoft Windows supports virtual memory by swapping segments of code (code that is the least recently used) from RAM 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; these settings are recommended.

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

Simplifying the Display

You can free memory for Visual FoxPro by simplifying the way windows and screen backgrounds are displayed.

  • To free memory for running applications, 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 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 lower resolution and less color support).

Managing Your Hard Drive

By managing your hard drive you can improve overall product speed. Follow these guidelines for getting the best performance from your hard disk:

  • Provide a generous amount of disk space.

    Disk input/output performance degrades significantly when a disk drive is nearly full. If your disk drive has little free space, you can increase Visual FoxPro performance by removing unnecessary data or by purchasing a larger capacity drive. The more free disk space 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 disk space therefore improves the 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.

Optimizing Files and Directories

The way that Windows and Visual FoxPro manage files on disk can greatly affect the performance of your application. This section explains how to:

  • Manage the number of files in a directory.
  • Manage how Visual FoxPro creates temporary files.

Managing Files in Directories

As a directory becomes increasingly congested with entries, the operating system takes longer to find files. How fast your system can search its directories is a function that is not under the control of Visual FoxPro.

To correct this situation, you must reduce the number of files in your directories. To reduce the number of files in your directories and speed up file search times, try the following:

  • Use the Project Manager to avoid creating numerous generated files. Segregate your program files into separate directories.

  • When you're ready to distribute your application, create an application or an executable file instead of numerous individually generated files.

    This procedure decreases the number of files in your application's subdirectories, thereby increasing performance.

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

    Deleting files from a directory does not immediately speed directory searching. When a file is deleted, the entry remains as a "hole" in the directory and is still included in directory searches.

  • When saving files, use short file paths to increase performance. For example, "c:\Program Files\Microsoft Visual Foxpro\..." is a very long file path.

Managing Temporary Files

Visual FoxPro creates temporary files for a variety of activities. For example, Visual FoxPro creates temporary files during editing, indexing, and sorting. Text editor sessions can also create a complete temporary copy of the file being edited.

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. Specify an alternate location by including one or more of the EDITWORK, SORTWORK, PROGWORK, or TMPFILES statements in the Config.fpw file.

To specify the location of temporary files

  1. From the Tools menu, choose Options and then choose the File Locations tab. Navigate down the list to Tempory Files under File Type.
  2. Enter a location for temporary files.

In most cases, you should specify one location for all Visual FoxPro temporary files. However, always make sure that the location you specify has enough space for all possible temporary files.

The directory of temporary files should contain as few files as possible. A low number of files reduces the amount of time Visual FoxPro waits for Windows to return file handles.

For more information on temporary files, see Optimizing Visual FoxPro in a Multiuser Environment.

See Also

Optimizing Your System | Optimizing Visual FoxPro Startup Speed | Managing Temporary Files | File Locations Tab, Options Dialog Box | Options Dialog Box