September 15th, 2013
Here are some preliminary results from a compiler/interpreter test, where we pitted different MSX compilers and cross-compilers against each other. The test was a simple integer addition loop. Here’s the Pascal version for a reference:
Program Bensmark; Var i,j,s:Integer; Begin s:=0; For i:=1 To 10000 Do For j:=1 To 100 Do s:=s+1; Writeln(s); End.
The snippet tests mostly loops, so the results can’t be generalized for all sorts of purposes. Anyway, here comes the list with execution times in seconds, arranged from fastest to slowest:
- Mildly unrolled assembly: 4
- Trivial assembly implementation: 8
- SDCC C cross-compiler 2.9.0: 13
- MSX-C 1.20: 44 – painfully slow compilation
- X-BASIC: 47
- Turbo Pascal: 62 – quick compilation
- z88dk C cross-compiler: 86
- Hisoft C 1.35: 154
- Hisoft Pascal: 880 – extrapolated from a shorter loop
- MSX-BASIC: 2500 – extrapolated from a shorter loop
Some big surpises there, actually. I expected a lot better performance from z88dk and Hisoft C, but they lost even to the ancient Turbo Pascal. TP got a big plus for its swift compilation time, too. X-BASIC went on to show that BASIC doesn’t need to be slow at all. In spite of its problems and somewhat modest code generation, SDCC easily took the crown of compiled high-level languages here.