I know the CPU is clocked at 3.25 instead of 3.5 MHz and that the CPU has to work harder to update the screen but I did a simple speed comparison and I found the ZX81 to be vastly slower even in FAST mode.
I typed this simple program:
10 for a=1 to 100
20 print a;
30 next a
The ZX Spectrum completed the above in about 1.8 seconds. The ZX81 was 36.4 seconds. Thinking this was due to the extra load the CPU has to work with to display screen content I changed to FAST mode. I expected the ZX81 to be behind but close to the Spectrum but instead I got a result of 10.7 seconds. About 6 times slower.
Surely in FAST mode the CPU wasn't under stress updating the screen? I know the RAM chips may be somewhat slower but surely not that much and the CPU is almost on par with the Spectrum? Was ZX81 BASIC not as streamlined as on the Spectrum?
I know this is not an conclusive test but could anyone shed any light on this? Thanks.
The spectrum has a fixed video ram.
There for no extra effort is needed when printing.
The ZX81 has a variable screen size and position.
When printing to the screen it needs to move the content of the ram around in order to find place to print at.
At least if memory is limited.
On a 16k ZX81 the problem should not occur.
kind regards Paul
- Posts: 2860
- Joined: Mon Sep 26, 2011 10:56 am
- Location: Looking forward to summer in Somerset, UK...
In fact, some parts of the ZX81 BASIC ROM code (if run at the same CPU speed as a ZX Spectrum) are slightly faster. As the ZX Spectrum ROM code has more conditions in it.
So, for speed, don't write to the screen unless you have to. And try not to do any writing to the screen in any loops.
One thing to keep in mind when comparing different BASICs, is that the ROM is made up of machine code instructions for the CPU. Sinclair wanted maximum functionality with the most features that could be fitted in (and some). So the writers used space efficient code. Some of this was at the expense of speed... [ZX81 = 8k bytes, ZX Spectrum = 16k bytes, BBC B = nearly 32k bytes, MTX = 24k bytes etc...]
Some years ago, when i dealt with benchmark tests, i got same result - printing is very slow.
(and in '83 too - when i decided to learn the z80 mc programming )
It depends on the size of the variables area. If there is just one loop counter, then the time difference is not significant (see this little video), but...Paul wrote:The ZX81 has a variable screen size and position. When printing to the screen it needs to move the content of the ram around in order to find place to print at. At least if memory is limited. On a 16k ZX81 the problem should not occur.
if we run the next code (the "DIM"-line increases the variables area), then the time difference is more than 6% (16k: 37.8 sec vs. 1K:40.3 sec)
Code: Select all
1 DIM A(100) 10 FOR I=1 TO 100 20 PRINT I; 30 NEXT I
I ran a few more tests, and I think I've found the cause of problem above - the PRINT-FP routine is the bottleneck.
It is not by chance that this section has been completely rewritten for the speccy's rom. Regards,