CPCWiki forum

General Category => Programming => Topic started by: ComSoft6128 on 18:50, 02 August 24

Title: Home computer BASIC performance tests, some benchmarks
Post by: ComSoft6128 on 18:50, 02 August 24
By "Retro64" from 2017

https://retro64.altervista.org/blog/home-computer-basic-performance-tests-some-benchmarks/
Title: Re: Home computer BASIC performance tests, some benchmarks
Post by: Prodatron on 19:43, 02 August 24
Here is a table for a better comparison:

8bitbasic.png

It's crazy, that all the other machines are mostly crap regarding Basic speed. No idea, why the Spectrum is so slow. MSX and C64 both have an original Microsoft Basic, just the C128 had a new Basic, which tried to catch up to the CPCs Locomotive Basic with not so much success it seems :D
Title: Re: Home computer BASIC performance tests, some benchmarks
Post by: Prodatron on 19:57, 02 August 24
Oh, great to see the performance of the last benchmark 8:
It is using scientific floating point functions,
Sinus, Natural Logarithm and Exponentiation.

Here the CPCs FP routines seem to be even much more powerful compared to the other systems (good to know, as I am using them in SymCalc  :) ).
Title: Re: Home computer BASIC performance tests, some benchmarks
Post by: jesusdelmas on 21:07, 02 August 24
Quote from: Prodatron on 19:43, 02 August 24Here is a table for a better comparison:

8bitbasic.png

It's crazy, that all the other machines are mostly crap regarding Basic speed. No idea, why the Spectrum is so slow. MSX and C64 both have an original Microsoft Basic, just the C128 had a new Basic, which tried to catch up to the CPCs Locomotive Basic with not so much success it seems :D
I always knew It. Amstrad Basic was a máster piece
Title: Re: Home computer BASIC performance tests, some benchmarks
Post by: robcfg on 21:32, 02 August 24
I think BBC Micro/Electron and the swedish Luxor ABC computers would be great candidates for this test too.

And it's no secret I have a veeeeery soft spot for the Dragon computers, so I may try on them  ;)
Title: Re: Home computer BASIC performance tests, some benchmarks
Post by: Prodatron on 21:35, 02 August 24
Quote from: robcfg on 21:32, 02 August 24I think BBC Micro/Electron and the swedish Luxor ABC computers would be great candidates for this test too.

And it's no secret I have a veeeeery soft spot for the Dragon computers, so I may try on them  ;)
Cool please do it, thats very interesting.
Title: Re: Home computer BASIC performance tests, some benchmarks
Post by: ZorrO on 04:01, 03 August 24
There is a video on YT comparing the speed of Basic on C64 and CPC using an algorithm for finding prime numbers.

10 FOR i=2 TO 1000
15 k = INT(SQR(i)) + 1
20 FOR j = 2 TO k
30 k1 = i / j
40 k2 = INT(k1)
50 IF k1 = k2 THEN GOTO 80
60 NEXT j
70 PRINT i
80 NEXT i

https://www.youtube.com/watch?v=pxye-RbKFpY


Some of my friends made the same test on other computers:

- 0'30 - Amiga Basic
- 0'44 - Atari ST Basic - but GW Basic or GFA Basic are much faster.
- 0'47 -  BBC Micro
- 1'04 - BBC Electron
- 1'14 - Sam Coupe
- 1'19 - CPC 6128 (80) - Math routines in 6128 are a bit faster than in 464
- 1'20 - Sinclair QL
- 1'22 - CPC 464 (40) - display in MODE 1 is a bit slower than in MODE 2.
- 1'23 - C128 (80) -  80 column mode is necessary to switch MOS processor into 2MHz
- 1'50 - C= Vic20
- 1'57 - Apple II
- 2'15 - C64       
- 2'16 - C+4       
- 2'48 - C128 (40)
- 3'28 - C128 CP/M - Microsoft Basic, on Z80 2MHz
- 3'50 - Atari XL/XE
- 3'53 - MSX1   
- 4'08 - ZX 48 
- 4'50 - ZX 128 
- 13'12 - ZX81 - with screen on is sooo slow, screen off gave time about 4 times faster 3'28

So to sum up, the approximate speed of Basic to BBC Micro. (Tested with a program for finding prime numbers). The number at the beginning of line means how many times slower than BBC Basic are Basic in others computers listed on this line.

1 - BBC, ST...
2 - CPC, C128 (80col), SamCoupe, QL, Electron...
3 - AppleII, C+4, Vic20...
4 - C64, TandyTRS...
5 - ZX81 (screen off)...
7 - ZX, XE, MSX...
20 - ZX81 (screen on)


And one more...  I don't remember where I found the results of the test comparing the speed of displaying letters. Amstrad is very poor here, but Fast Print procedures (as for example in XD-DOS ROM) speed it up by about 7 times, which would give the best result.

ZX 81                                          -->                                                          110
ZX 48                    25
CPC                    24
C128                21
ZX +2              20
C+4                19
MSX            15
C64            15
XL/XE      12
Meritum    11
Apple II  10
Vic20    9
Elec.  7
BBC  5
Title: Re: Home computer BASIC performance tests, some benchmarks
Post by: lmimmfn on 09:20, 03 August 24
Regarding the speed of displaying characters and fast print routines, presumably basis is using the firmware? Has anyone tried to patch CPC roms to improve this or other things?
Title: Re: Home computer BASIC performance tests, some benchmarks
Post by: andycadley on 09:59, 03 August 24
Not really surprised about the print speed, the faster machines have character mapped displays so only need to write a single byte to put a character on screen. Not easy to compete with that when you have to update a bitmap (and especially not one as large as the CPC).
Title: Re: Home computer BASIC performance tests, some benchmarks
Post by: retro space on 15:55, 03 August 24
P2000T (Z80 @ 2,5MHz)
1: 1,8s
2: 7s
3: 17s
4: 19s
5: 19,5s
6: 31s
7: 49s
8: 88s
Not bad to end between the C64 and C128. And totally weird it outperforms the next-in-line Philips computer, the MSX.
Also note the routines get quicker if you use % variables for counters, where on a C64 that makes execution slower.

Primenumber test 2:04
Title: Re: Home computer BASIC performance tests, some benchmarks
Post by: Prodatron on 21:19, 03 August 24
Quote from: retro space on 15:55, 03 August 24P2000T (Z80 @ 2,5MHz)
1: 1,8s
2: 7s
3: 17s
4: 19s
5: 19,5s
6: 31s
7: 49s
8: 88s
Not bad to end between the C64 and C128. And totally weird it outperforms the next-in-line Philips computer, the MSX.
Also note the routines get quicker if you use % variables for counters, where on a C64 that makes execution slower.

Primenumber test 2:04
Philips probably used another Basic (Not Microsoft) before the MSX?
Title: Re: Home computer BASIC performance tests, some benchmarks
Post by: retro space on 21:39, 03 August 24
Philips P2000T Basic is made by Microsoft in 1980, but unlike with most others, it is not visible on boot nor in the binary code.
Title: Re: Home computer BASIC performance tests, some benchmarks
Post by: jjne on 15:56, 05 September 24
The Spectrum's BASIC was optimised for space restraints rather than performance, as was Sinclair's way. The MSX being slow is more of a mystery - there's no real reason it should be significantly slower than the CPC. 
Title: Re: Home computer BASIC performance tests, some benchmarks
Post by: Prodatron on 09:17, 06 September 24
Quote from: jjne on 15:56, 05 September 24The MSX being slow is more of a mystery - there's no real reason it should be significantly slower than the CPC.
(Possible) Reason 1:
MSX Basic is based on "Basic-80", which was written for the Intel 8080 with no usage of the advanced Z80 possibilities. While MSX-DOS is optimized for the Z80 I have no idea if they upgraded the Basic-80 code used in MSX-Basic for Z80 efficency as well.

Reason 2:
MSX Basic is using decimal (BCD) based floating point routines, which has sometimes advantages regarding rounding issues. I don't know how much, but of course this is slower than using binary based floating points like in Locomotive Basic.

Reason 3:
IIRC MSX Basic works with double-precision values by default, which use 64 bits (8 bytes) for each number ( see here (https://www.msx.org/wiki/BASIC_Routines_In_Main-ROM#Math-pack_routines) ). The FPs in Locomotive Basic are "only" 40 bits (5 bytes) in size.

While reason 1 is only a speculation, reason 2 is a fact and reason 3 is something which I read in the MSX forum.
Title: Re: Home computer BASIC performance tests, some benchmarks
Post by: ZorrO on 17:13, 06 September 24
There is faster Basic for MSX2 on Cartridge, I forget name.
As I know most MSX2 have old Basic from MSX1, without extra command for new graphic modes and better more colors in sprites. So they have similar problem like CPC+ owners.
Title: Re: Home computer BASIC performance tests, some benchmarks
Post by: Prodatron on 13:25, 08 September 24
Quote from: ZorrO on 17:13, 06 September 24There is faster Basic for MSX2 on Cartridge, I forget name.
May you have one of these basic compilers in mind?


Quote from: ZorrO on 17:13, 06 September 24As I know most MSX2 have old Basic from MSX1, without extra command for new graphic modes and better more colors in sprites. So they have similar problem like CPC+ owners.
No, all MSX2 machines have MSX Basic 2.x. MSX had some very strictly defined standards.

The same for MSX2+ machines, which all have MSX Basic 3.0, and TurboR machines, which all have MSX Basic 4.x.

All these newer basic versions supported (most of?) the new features of the newer machine generations. So they didn't have the problems like the CPC+.

Maybe you mixed this with the Disc Basic version. Most had low version numbers like "1.0", see here (thanks to @Edoz(MSX) for the information!):


Unbenannt.jpg
Title: Re: Home computer BASIC performance tests, some benchmarks
Post by: McArti0 on 22:02, 08 September 24
Quote from: ZorrO on 04:01, 03 August 2410 FOR i=2 TO 1000
15 k = INT(SQR(i)) + 1
20 FOR j = 2 TO k
30 k1 = i / j
40 k2 = INT(k1)
50 IF k1 = k2 THEN GOTO 80
60 NEXT j
70 PRINT i
80 NEXT i


- 3'53 - MSX1   


For single precision (all variables V! instead V#) - 3'47  :-X instead 3'53
Powered by SMFPacks Menu Editor Mod