litwr wrote:
I have also added data for the MSX2 which shows a surprisingly slow result.
It's not really all that surprising, no. Unlike other Microsoft BASICs, MSX BASIC uses decimal rather than binary significands, which is probably a performance hit right there, and, more importantly, in your case is probably using double precision floating point (14 digit significands and a 7-bit binary exponent).
I have tried to replicate your benchmark (more on this below) and came out with 521.9 seconds (versus your 554.98) based on the
TIME variable and confirmed roughly against a wall clock on my Japanese Sanyo MPC-2 (Wavy2), which is an NTSC MSX1 machine running an earlier version of BASIC (1.0 instead of 2.0).
In the benchmark above I added a line
165 DEFDBL A-Z to ensure that I was using double precision (though this is the default, and the result is the same without it). Changing that to
DEFSNG uses 6-digit significands which is I think is a more fair comparison to other MS-BASICs and seems to produce the same visual output. This takes 413.37 seconds, a 21% improvement, which puts the MSX machine between the Commodore Plus/4 (MSX1 being 15% faster) and the Commodore 64 (MSX1 being 7% slower).
(I've also run the benchmarks above on a Japanese Sony HB-55, also MSX1, and came out with the same numbers within .02%: 521.98 s and 413.45 s.)
Regarding your post, especially in its original version, you could have made it a lot more clear what changes you were making to the original benchmark code. It took me some time to replicate your output, and it didn't help that for the MSX one you've both lost the top line of the output and terminated the program differently (or not terminated at all, I think; I replicated with
515 GOTO 515 to prevent the program from exiting). You should also check the result from
TIME against a wall clock; since
TIME doesn't increment when interrupts are disabled it may undercount the time used. (I confirmed that it's very close on my machine, but this may vary across MSX models.) You should also mention that dividing
TIME by 60 to get seconds applies only to NTSC MSX models; since it's based on the video refresh interrupt this would need to be 50 on PAL machines.
I'm not clear on why your MSX2 is noticeably slower (6%) than my MSX1, despite being a newer machine running a newer version of BASIC. Perhaps it's actually faster and you're using a PAL model? Without knowing what hardware you tested on, it's hard even to guess. (I'll have another go at this on one of my MSX2 machines if I can get one up and running; I'm currently waiting on a power supply for them.)
I just use Open MSX emulator with the Sanyo MPC-25FD. I can only suppose that maybe MSX1 Basic is a bit faster than more complex MSX2 Basic. The CPU frequency are the same in the MSX1 and MSX2. Maybe the observed 5% difference is also caused by small frequency difference for those computer models.
EDIT. Small timing difference may also be caused by different interrupt handlers.