The Limits of Architecture vs. The Architecture of Limits (by John Koziol)

With every new version of Visual FoxPro our customers get lots of new functions and commands to study and integrate into their development efforts. Or, in some cases, existing commands and functions are enhanced with new functionality.  Visual FoxPro 9 continues this tradition, and adds a new dimension to application architecture:  Many legacy VFP limitations have been eliminated, well, that is, VFP no longer imposes limitations but system resources may.

This may - or maybe even should - make one rethink how an application is architected.

The three areas I'd like to focus on are SELECT - SQL, arrays, and DO nesting levels.

The limitation of 9 JOIN clauses in SELECT - SQL have been removed. I don't know about you all, but I can remember writing a slew of SQL statements that aggregated results simply because of that limitation. You can now add JOIN clauses to you hearts desire.  In conjunction with some subtle engine optimization enhancements for VFP9, your data munging through SQL may be able to be rearchitected for much greater speed and efficiency.

Arrays are no longer limited to 64K (65,536) elements. The number of elements is now limited to 2GB or system memory (member object arrays are limited to 65,000).  In testing I have found that a safe upper element limit on a Windows XP machine with 1GB of RAM is in the high 30 millions. If you attempt to dimension an array which exceeds system capacities, you'll get the error "Not enough memory to complete operation".

A clear benefit of this enhancement is when hashing through temporary data.  In the past, unless you were sure that there were less than 64K data elements to manipulate, data was stored and changed in temp tables.  While VFP is extremely fast when dealing with tables, most RAM memory operations may be faster - so - there may be opportunities for you to cut down on the number of temporary files or tables when manipulating data.

DO nesting, commonly used in recursive routines, may be increased using the new STACKSIZE keyword for CONFIG.FPW files.  You can increase the nesting level to 64,000 (or decrease to 32). There are several public-domain utilities that recurse through the structure of container objects (my old Evil Bag O' Tricks found in the Universal Thread is one of them). The 128 level limitation made recursing through the structure of a complicated container rather problematic.  Not any more.

How all of this applies to your specific development efforts will vary; however, I hope I've given you some ideas on evaluating legacy code blocks for optimization when you make the move to Visual FoxPro 9.


Skip to main content