Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Articles
Search: 

Optimizing the VFP Bufffer Size
James Weil, September 21, 2001
This article is an excerpt from the Mere Mortals framework Developer's User Guide, written by Kevin McNeish. The default memory buffer size that Windows assigns to Visual FoxPro at startup is often incorrect. Usually, Windows reports more physical memory than is truly available. This means that V...
Summary
This article is an excerpt from the Mere Mortals framework Developer's User Guide, written by Kevin McNeish. The default memory buffer size that Windows assigns to Visual FoxPro at startup is often incorrect. Usually, Windows reports more physical memory than is truly available. This means that Visual FoxPro is often using Virtual Memory (on the hard disk) when it reaches the high end of its memory pool. This can slow Visual FoxPro down considerably! To get around this problem, you can use the SYS(3050,1) command to manually set the memory buffer size for Visual FoxPro. Unfortunately, the optimal memory buffer size for Visual FoxPro or a VFP application can change from one hardware configuration to another. Determining the optimal setting can be time-consuming, however the resulting increase in speed often makes it worth the effort
Description
In the February 1997 issue of FoxTalk, Flavio Almeida and Walter Loughney describe this problem and suggest a test for determining the optimal memory buffer setting for a given hardware configuration. Here are some steps for setting up a testing scenario: 1. Create a program file that contains the following code to create a test table (change the drive and directory designations to fit your development environment): SET DEFA TO C:\VFP\TEST USE C:\VFP\SAMPLES\DATA\CUSTOMER COPY STRUCTURE TO TESTDATA USE TESTDATA FOR I = 1 TO 2000 APPEND FROM C:\VFP\SAMPLES\DATA\CUSTOMER ENDFOR USE Execute the above code. It will create a new table called TestData.dbf that is approximately 50MB in size, and contains 184,000 records. 2. Shut down your computer and restart it. This ensures a level playing field for each subsequent test. 3. After the computer restarts, run Visual FoxPro and enter the following in the Command Window: ?SYS(3050,1) This command displays the amount of foreground memory Windows has assigned to Visual FoxPro. Write this number down. 4. In the Visual FoxPro Command Window, enter the following: CD C:\VFP\TEST USE TESTDATA SELECT * FROM TESTDATA WHERE REGION = 'BC' A thermometer will display the progress of the SELECT statement. Watch the status bar closely. When the SELECT is complete, it will show the number of records selected and the elapsed time of the select in seconds. Write this number down. Repeat steps 2-4, except at step 3, use the third parameter in SYS(3050,1,n) to specify a lower memory limit than what was assigned to Visual FoxPro by default. Try dropping the memory buffer size down 1MB for each test you run. You should notice a measurable speed improvement right away. Keep dropping the memory buffer size by 1MB until the elapsed time starts to increase again. Example: If Visual FoxPro was originally allocated 18MB of memory, try setting the value to 17MB by issuing the command: SYS(3050,1,17000000).
More articles from this author
James Weil, July 1, 2001
The long-awaited release of version 6.1 of the Mere Mortals framework from Oak Leaf Enterprises Solution Design, Inc. provides a quantum leap from a logical three-tier architecture to a true Windows’ Distributed Network Architecture (DNA). Although this was Flash's original vision for its Codebook 3...
James Weil, January 1, 2001
According to Microsoft, the Visual Foxpro setup can be run in quiet mode. RUN setup.exe /Q This will launch and run setup without user intervention. The following parameters will run Setup in quiet mode with various options: /Q will run setup with the "Initializing setup..." dialogue...