Microsoft KB Archive/87807

{| = SET DOHISTORY ON Slows Performance of FoxPro =
 * width="100%"|

ID: Q87807

The information in this article applies to:


 * Microsoft FoxPro for MS-DOS, versions 1.0, 1.01, 1.02, 2.0, 2.5, and 2.5a
 * Microsoft FoxPro for Windows, versions 2.5 and 2.5a

SUMMARY
The SET DOHISTORY ON command affects the performance of Microsoft FoxPro. Use this command only for debugging purposes.

MORE INFORMATION
Some users have reported that, contrary to their expectations, FoxPro takes longer to run an application than Microsoft FoxBASE+. Upon further investigation, it was determined that the SET DOHISTORY ON command is in the slow application. Once this command has been removed from the application, FoxPro runs much faster than FoxBASE+.

FoxBASE+ implements the SET DOHISTORY feature by dynamically decompiling the executed code, placing the resulting pseudocode in a fixed-sized buffer, and discarding the oldest source line(s) when the buffer fills up. While this process is reasonably efficient, FoxBASE+ programs run several times slower when DOHISTORY is ON.

FoxPro object code is very different from FoxBASE+ code; it is almost impossible to decompile FoxPro code. Therefore, in FoxPro, the original source code must be present to provide the TRACE, DEBUG, and other debugging facilities.

The DOHISTORY capability in FoxPro appends the actual source line to the code in the Command window. There is no arbitrary limit on the amount of source code that this method makes available. Because the Command window is a special instance of the FoxPro editor, DOHISTORY causes the Command window to construct a disk-based document.

While this method has certain obvious advantages, it is slower than the method employed in FoxBASE+. It is also possible to fill up even a large disk very quickly.

The SET DOHISTORY ON command should be used only as a temporary debugging aide to isolate particularly stubborn bugs in application code.

Additional reference words: FoxDos FoxWin 1.00 2.00 2.50 2.50a 2.x Fox base plus KBCategory: kbprg KBSubcategory: FxprgGeneral
 * }