FORTH BENCHMARKS
does the trick here. Some readers may wonder why TEST> and TEST< are both included. When I was checking out different candidates I discovered that on my system (xForth 1.2) a > test is 50% slower than a < test, because it is defined at high level using G. I thought this was useful knowledge as by choosing appropriate logic it is possible to save time, and so included both in the BMs.
I deliberately haven't included any timings for compilation as this is so I/O dependent; there would be no basis for comparison between disk and cassette based systems for example.
What of the systems timed here? Z-80 FORTH is a product of Laboratory Microsystems in Los Angeles and has established itself as one of the best CP/M systems available. It is based on fig-FORTH 1.1 recoded for the Z80. It features a first class screen editor, floating point extensions, and a true Z80 assembler and it has the ability to generate a new system for any RAM size of host with any required extensions included. All the high level source code is included and it uses a CP/M-compatible file format to store screens.
xForth is a British product from AIM Research of Cambridge, and also runs under CP/M. It has a 79 Standard kernel with lots of very advanced extensions. In particular, it has facilities for modular programming with local variables, run-time conditionals and conditional assembly (8080 assembler), and full CP/M file handling capabilities which can access, for instance, Wordstar files. Floating point and sequential files (with pipes and spooling) are available as extras. It has an even better screen editor than Z-80 FORTH which includes a global search-and-replace and user configurable control codes.
PicoFORTH is a 'kosher' product from Forth Inc, itself, distributed in the UK by Computer Solutions of Chertsey. Meant as an introduction to Forth programming rather than as a professional system, it is a smallish single-user subset of their multitasking polyFORTH. An 8080 assembler is provided but only the original Forth line editor which is rather spartan compared to the editors on the other systems tested. Although it boots from CP/M it does not use CP/M compatible files but 'pure' Forth blocks. This means you cannot, for instance, copy files with PIP nor interface with CP/M via system calls.
GraFORTH is a special graphics language, based on Forth, for the Apple II; it is written by Paul Lutus of Applewriter fame (notoriety?). It provides some very nice features for animated 3D graphics and music synthesizing. The demo programs impressed everyone who saw them, even given the limited resolution of Apple graphics. It is possible to draw a wire-frame picture using turtle graphics and then animate it by scaling, rotation and translation without any more drawing at all. As a Forth system it is rather eccentric with numerous wilful deviations from Forth practice which make it hard to come to or go from this to a 'standard' system. For instance, variables are handled in a Basic-like assignment statement eg, L 1 + > L and put their value rather than address on the stack when called (which is why I have no timing for 'variable'). The editor is based on the Apple Basic editor using the same ESC codes and line numbers; it is quite nice to use. No floating point or assembler is included. Unusually GraFORTH is directly threaded - ie, it compiles 6502 code rather than pointers into its headers; the effect on the time for 'dictionary-search' is very noticeable.
Working Forth is a teaching system from Mountain View Press of California based on standard fig-FORTH. Like picoFORTH, this is a 'pure' system which doesn't use CP/M files. It has a large number of screens of teaching-machine type instruction which have the nice feature that the student can come out into Forth and do exercises and then easily start at the point he/she left off (or indeed repeat a lesson). The quality of the teaching is high, if perhaps rather forbidding the total novice; it would be better to know Basic and best to know some Assembler before approaching it. It represents terrific value for money, though, because you get a full Forth system with assembler and editor (an enhanced line editor) which will keep you happy long after you finish the teaching course. They even give you the assembler source for the kernel on disk. The documentation is very rudimentary, however, as most of it is meant to be on the screen.
At the last minute before hitting the press I received a copy of Kuma Computers' Forth for the Sirius 1. This is a fig-1.1 based system written in genuine 8088 code, and as you will see from the timings it is indeed quicker than a 4MHz Z80 version except in
the odd case of 'increment' (maybe in high-level?). It seems, at cursory acquaintance, to be a nice implementation, with a simple but effective screen editor. It seems, at cursory acquaintance, to be a nice implementation, with a simple but effective screen editor. It goes well beyond the 79 Standard with a large part of the Reference Word-set included. It comes with
Block 8003
0 ( Benchmarks 3)
1
2 9 CONSTANT K
3
4 : constant ." S" 10001 1 DO
511 1 DO K LOOP
6SP! LOOP ." E" ;
7
8 : dup ." S" 10001 1 DO
911 1 DO 9 DUP LOOP
10SP! LOOP ." E" ;
11
12 : increment ." S" 10001 1 DO
1311 1 DO 9 1+ LOOP
14SP! LOOP ." E" ;
15 -->
Block 8004
0 ( Benchmarks 4)
1
2 : test> ." S" 10001 1 DO
3 11 1 DO 9 9 > LOOP
4 SP! LOOP ." E" ;
5
6
7 : test< ." S" 10001 1 DO
8 11 1 DO 9 9 < LOOP
9 SP! LOOP ." E" ;
10
11
12 : arithmetic ." S" 10001 1 DO
139 2 / 3 * 4 + 5 -
14SP! LOOP ." E" ;
15 -->
Block 8005
0 ( Benchmarks 5)
1
2
3 : while-loop ." S" 10001 1 DO
4 1 BEGIN 1+ DUP 11 < WHILE REPEAT
5 SP! LOOP ." E" ;
6
7
8
9 : until-loop ." S" 10001 1 DO
10 20 BEGIN 1- DUP 11 < UNTIL
11 SP! LOOP ." E" ;
12
13
14
15 -->
Block 8006
0 ( Benchmarks 6)
1
2 : ten ;
3 : nine ten ;
4 : eight nine ;
5 : seven eight ;
6 : six seven ;
7 : five six ;
8 : four five ;
9 : three four ;
10 : two three ;
11 : one two ;
12
13 : dictionary-search ." S" 10001 1 DO
14 one
15 SP! LOOP ." E" ; -->