BUG: String Manipulation Slower in Compiler Vs Interpreter (20456)



The information in this article applies to:

  • Microsoft QuickBASIC Compiler for the Apple Macintosh 1.0

This article was previously published under Q20456

SYMPTOMS

String manipulation functions can be several times slower in compiled programs than in interpreted programs. The speed of the compiled example below can be improved by 50 percent by compiling with the Microsoft QuickBasic Compiler version 1.0 for Macintosh, instead of compiling with the earlier Microsoft Basic Compiler version 1.0. However, the example compiled in QuickBasic is still five times slower than the interpreted version.

CAUSE

This speed problem is partly due to a tradeoff of code size versus speed. For example, the interpreter offers efficient extra code to handle strings quickly; the compiled program offers smaller code size but less efficient string handling. The interpreter itself takes much more disk space than the independent, compiled program.

STATUS

Microsoft has confirmed this to be a bug in Microsoft QuickBasic version 1.0 for the Macintosh. We are researching this problem and will post new information here in the Microsoft Knowledge Base as it becomes available.

MORE INFORMATION

The string manipulation program below gives the following timing results on a Macintosh SE computer:
Product                                      Timing Result
----------------------------------------------------------

QuickBasic version 1.0 interpreter (binary)  25 seconds
Basic version 3.0 interpreter (b)            25 seconds
QuickBasic version 1.0 compiler (b)          127 seconds
Basic version 1.0 compiler (b)               194 seconds
				
The example below was compiled using the R option in the Basic compiler version 1.0 and using the equivalent Include the Runtime Code option in the QuickBasic compiler. The Process Runtime Events option was off at compile time.
DEFINT I-J
START=TIMER
A$=SPACE$(10000)
FOR K=1 TO LEN(A$)
J=ASC(MID$(A$,K,1))
NEXT
PRINT TIMER-START;"SECONDS"
WHILE MOUSE(0)=0 : WEND
				

Modification Type:MinorLast Reviewed:1/9/2003
Keywords:kbbug KB20456