CPCWiki forum

General Category => Off topic => Topic started by: ukmarkh on 20:44, 22 April 18

Title: Amstrad CPC Machine code speed test
Post by: ukmarkh on 20:44, 22 April 18
We all know that the Amstrad CPC kicks the C64 and every 8bit Machine in regards to basic, thanks to Locomotive, but how does it perform running a 1000 prime number raw calculations test in machine code, talking directly to the hardware in comparison to the other 8bits?

Has anyone ever tried this or written code, maybe this is something Amstrad Action covered, but it would be great to know.

http://retro64.altervista.org/blog/home-computer-basic-performance-tests-some-benchmarks/

https://youtu.be/pxye-RbKFpY





Sent from my iPhone using Tapatalk
Title: Re: Amstrad CPC Machine code speed test
Post by: Urusergi on 02:18, 23 April 18
 :picard: That code is very slow and ugly. Instead, this one is super optimized (7.21 sec  8) ):

Code: [Select]
10 MODE 2:DEFINT a-y:ZONE 8:z=TIME:p=3:m=1000:DIM s(m+1):PRINT 2,
20 WHILE s(p):p=p+2:WEND:FOR i=p TO m STEP p*2:s(i)=-1:NEXT:IF p<m THEN PRINT p,:GOTO 20 ELSE PRINT:PRINT(TIME-z)/300
Title: Re: Amstrad CPC Machine code speed test
Post by: ukmarkh on 09:41, 23 April 18
:picard: That code is very slow and ugly. Instead, this one is super optimized (7.21 sec  8) ):

Code: [Select]
10 MODE 2:DEFINT a-y:ZONE 8:z=TIME:p=3:m=1000:DIM s(m+1):PRINT 2,
20 WHILE s(p):p=p+2:WEND:FOR i=p TO m STEP p*2:s(i)=-1:NEXT:IF p<m THEN PRINT p,:GOTO 20 ELSE PRINT:PRINT(TIME-z)/300

Hi, but we need to rule out optimum or ugly code and talk directly to the hardware otherwise optimisation might be used as an argument in the other camps. It’s purely an experiment, outside of basic.


Sent from my iPhone using Tapatalk
Title: Re: Amstrad CPC Machine code speed test
Post by: MaV on 14:05, 23 April 18
litwr wrote a bunch of machine code programs for various platforms intended for speed comparisons.
Title: Re: Amstrad CPC Machine code speed test
Post by: Urusergi on 17:18, 23 April 18
Hi, but we need to rule out optimum or ugly code and talk directly to the hardware otherwise optimisation might be used as an argument in the other camps. It’s purely an experiment, outside of basic.

Yes, I understand you correctly. I was trying to say that my code, apart from being much faster, is more convenient or easy to make an assembly implementation (additions & multiplications by 2)
Title: Re: Amstrad CPC Machine code speed test
Post by: ukmarkh on 20:50, 24 April 18
litwr wrote a bunch of machine code programs for various platforms intended for speed comparisons.

Any links [emoji848]


Sent from my iPhone using Tapatalk
Title: Re: Amstrad CPC Machine code speed test
Post by: MaV on 12:07, 25 April 18
Any links (https://emoji.tapatalk-cdn.com/emoji848.png)
http://litwr2.atspace.eu/pi/pi-spigot-benchmark.html
There you are. Calculating PI with the spigot algorithm.
For some reason I thought there was more than one type of benchmark, but it certainly is more than one platform.
Title: Re: Amstrad CPC Machine code speed test
Post by: andycadley on 10:32, 26 April 18

The problem with micro-benchmarks like this is that they don't really meaningfully translate into practical results once you go beyond really high level tasks like BASIC (where they're really as much a test of how well the interpreter performs rather than the machines per se). I've seen multiplication routines on a 1MHz 6502 that can outperform a 4MHz Z80, but do so by monopolising the zero page in a way you probably can't do in a real-world application without taking a massive performance hit elsewhere. Equally some types of problem are better suited to one machine over the other - for example anything that prints text has a huge advantage on the C64 in not needing to update a bitmap, but anything that draws graphs (or mixes text and graphics) takes a hit because the C64 display doesn't particularly lend itself to that (and manipulating it in bitmap mode exposes the slower raw CPU grunt).