Here are some figures on how fast Wang BASIC running on a 2200 CPU was for various tasks. The numbers below are for the 2200 A/B/C/S/T CPU; the 2200VP was a much faster machine.

Here are some quick links to the sections on this page.

- Statement Timings
- Memory Write Bandwidth
- Memory Move Bandwidth
- Sieve of Eratosthenes
- Wang 2200VP Performance

## Statement Timings (link)

From *System 2200 Hardware Pocket Guide*, pp.36-37, and from the
2200 service manual, pp. 1-19 through 1-22, except as noted:

CENTRAL PROCESSOR SPECIFICATIONS

Average execution times determined using Random Number Arguments with 13 digits of precision. Speeds are faster in calculations with arguments of less precision.

Average Execution Times within Expressions Time Conditions/Remarks add 0.8 ms subtract 0.8 ms multiply 3.9 ms divide 7.4 ms square root 46.4 ms x^y 45.4 ms e^x 25.3 ms ln(x) 23.2 ms integer 0.24 ms absolute value 0.02 ms sign 0.25 ms sine 38.3 ms cosine 38.9 ms tangent 78.5 ms arctangent 72.5 ms random number [RND(1)] 25 ms timing by web page author read/write cycle 1.6 usec 2200 A/B Instructions Instruction Optimum Time Conditions/Remarks REM 0.384 ms DEFFN'1:RETURN 3.360 ms SELECT PRINT 005 0.984 ms SELECT PRINT 005(64) 1.200 ms GOTO 2.640 ms IF THEN (NUMERIC) 4.320 ms condition not met IF THEN (NUMERIC) 4.840 ms condition met IF R1$=HEX THEN NNNN 2.640 ms IF R1$=A1$ THEN NNNN 3.120 ms PRINTUSING, 1, A 8.892 ms display 12 characters NEXT 4.380 ms on CRT LET A=B 3.240 ms LET B=A(1) 5.280 ms LET B=A(255) 5.400 ms LET B=123456 2.880 ms LET X=1 2.880 ms LET X=Y 3.190 ms LET X=Y(3) 5.610 ms Y is dimensioned to 12 LET X=Y(J) 6.810 ms J=3 LET X=Y(3,4) 7.010 ms DIM Y(6,8) LET X=Y(J,K) 9.210 ms J=3, K=4 LET X=Y(J+K) 9.310 ms DIM Y(12) J=3 K=4 LET X=Y(J*K) 10.810 ms DIM Y(12) J=3 K=4 LET B$='0123456789ABCDEF' 2.460 ms LET A$=B$ 2.700 ms LET A$=STR(B$,1,16) 5.376 ms LET A$=STR(B$,8,1) 5.400 ms LET A$='1' 2.635 ms LET A$=B$ 3.010 ms DIM A$1,B$1 LET A$=B$ 3.900 ms DIM A$1,B$64 LET A$=B$ 4.760 ms DIM A$64,B$1 LET A$=B$ 5.700 ms DIM A$64,B$64 LET A$=STR(B$,1,1) 7.385 ms LET STR(A$,1,1)=STR(B$,1,1) 8.310 ms LET STR(A$,1,64)=STR(B$,1,64) 9.735 ms LET STR(A$,1,30)=STR(B$,32) 8.160 ms LET STR(A$,32,1)=STR(B$,32,1) 8.560 ms LET STR(A$,64,1)=STR(B$,64,1) 8.535 ms LET STR(A$,64)=STR(B$,64) 6.560 ms LET STR(A$,1,64)=STR(B$,1,1) 8.435 ms 2200 B INSTRUCTIONS Time Conditions/Remarks B=LEN(A$) 4.140 ms B=VAL(A$) 3.960 ms ADD(A$,01) 2.970 ms ADDC(A$,01) 3.000 ms ADD(A$,B$) 3.696 ms AND(A$,FF) 6.240 ms BIN(A$)=64 2.760 ms BIN(STR(A$,16,1))=64 5.232 ms BOOL E(A$,55) 5.040 ms BOOL F(A$,B$) 6.960 ms CONVERT A TO A$, (#####) 4.896 ms CONVERT X*2 TO A$, (+##.##) 8.360 ms CONVERT X TO STR(A$,3,8), (-#.#####) 7.710 ms CONVERT A$ TO Z 3.710 ms CONVERT STR(A$,3,8) TO Z 6.235 ms CONVERT X TO A$, (####.#####) 5.560 ms INIT (80)A$ 2.400 ms B=NUM(A$) 4.800 ms A$=10 digits B=NUM(A$) 4.560 ms A$=1 digit ON B GOTO NNNN 4.800 ms B=1 GOTO condition ON B GOTO NNNN 2.520 ms B=5 fall through condition PACK(####)A$ FROM A 4.320 ms PACK(####.####)A$ FROM A 4.704 ms ROTATE(A$,1) 2.970 ms ROTATE(A$,7) 3.816 ms UNPACK(####) A$ TO B 3.960 ms

## Memory Write Bandwidth (link)

How fast can the Wang hammer memory? Here are some programs that try to measure that.

In the limit, one nibble of memory can be written each microcycle (1.6 us). In practice, the actual throughput is much lower due to looping overheads.

10 DIM A$(64)64: REM 4KB 20 FOR I=1 TO 256 30 INIT ("$") A$() 40 NEXT I

This program writes 1 MB of memory in 14 seconds, for a fill rate of 73 KB/sec. If the microcode had no overhead, it would be able to execute this in 3.4 seconds, so it is running at 25% efficiency.

## Memory Move Bandwidth (link)

Memory moves consist of reading a string of bytes from one location and writing them to another location. This test attempts to measure how fast that can be done.

10 DIM A$(64)64: REM 4KB 20 FOR I=1 TO 256 30 MAT COPY A$()<1,4096> TO A$()<1,4096> 40 NEXT I

This reads 1 MB and writes that 1 MB back on itself in 26 seconds, for a copy rate of 39.4 KB/sec. The microarchitecture can either read a byte or write a nibble each microcycle, so in theory this transfer could have been done in 5.03 seconds. Thus it is actually operating at 20% efficiency in this case.

## Sieve Benchmark (link)

Back in September of 1981, Byte magazine presented a few small BASIC programs for testing system performance. One of the more famous ones was the Sieve of Eratosthenes. The benchmark was widely (and rightly) criticized for its shortcomings but it was also widely used. The benchmark uses 8192 flags to indicate which numbers have been proven not prime. Wang BASIC can't address strings that long directly nor can it store 8192 integers for use as flags (because all numbers use 8 byte floating point representation). Instead, Wang BASIC has to use a very awkward mechanism for accessing the Nth byte of a string array.

Without further ado, here is one direct mapping of the standard benchmark into Wang BASIC:

20 REM A$() contains flags indicating which numbers have divisors or not 30 REM Because we skip all even numbers, including 2, the first flag, at 40 REM array offset 1, corresponds to 3. the second flag is 5, etc. 50 DIM A$(128)64:REM prime flags 60 DIM D$(1)1:REM one byte array 70 DIM F$(1)1:REM constant "F" 80 INIT ("T") A$():INIT ("F") F$() 90 C=0:REM number of primes 100 FOR I=1 TO 8192 110 MAT COPY A$()<I,1> TO D$():IF D$(1)="F" THEN 180 120 P=I+I+1 130 IF I+P>8192 THEN 170 140 FOR K=I+P TO 8192 STEP P 150 MAT COPY F$() TO A$()<K,1> 160 NEXT K 170 C=C+1 180 NEXT I 190 PRINT C;"primes"

Wang BASIC running on a 2200T CPU takes about 5:13 (313 seconds).

## Wang 2200VP Performance (link)

The second generation CPU that powered the VP and MVP families was much faster than the first generation for a few reasons. First, the microarchitecture of the CPU was simply more powerful. It could readily compute 16 bit binary sums in a single instruction, while the 2200T could process only four bits per instruction. The instruction cycle time was also much faster: most operated in 600 ns on the 2200VP, while each 2200T instruction was 1600 ns. Third, when Wang BASIC was developed originally, priority was placed on making the interpreter small, instead of fast.

Wang Systems Newsletter, No. 4 has timing information for some elementary operations under BASIC-2 running on a 2200VP CPU vs. the same operations under Wang BASIC running on a 2200T CPU.

Function | 2200VP | 2200T |
---|---|---|

X+Y | 0.11 ms | 0.8 ms |

X*Y | 0.38 ms | 3.9 ms |

X/Y | 0.76 ms | 7.4 ms |

X^Y | 6.2 ms | 45.4 ms |

LOG | 3.2 ms | 23.2 ms |

SQR | 1.7 ms | 46.4 ms |

TAN | 7.7 ms | 78.5 ms |

RND | 0.27 ms | 24.0 ms |

Comparing BASIC-2 running on the 2200VP CPU, the Memory Write Bandwidth program ran in 2.4 seconds, about 5.8 times faster than Wang BASIC on the 2200T CPU.

Likewise, the Memory Move Bandwidth program ran in 3.2 seconds on the 2200VP, about 8.1 times faster than the 2200T CPU.

Finally, the Sieve benchmark ran in 23.5 seconds, about 13 times faster than the 2200T performance. Taking advantage of the improved functionality of BASIC-2, this time could be reduced further, but that isn't the point of this comparison.