Amstrad CPC Machine code speed test

Started by ukmarkh, 20:44, 22 April 18

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

ukmarkh

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

Urusergi

 :picard: That code is very slow and ugly. Instead, this one is super optimized (7.21 sec  8) ):

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

ukmarkh

Quote from: 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) ):

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

MaV

litwr wrote a bunch of machine code programs for various platforms intended for speed comparisons.
Black Mesa Transit Announcement System:
"Work safe, work smart. Your future depends on it."

Urusergi

Quote from: ukmarkh on 09:41, 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)

ukmarkh

Quote from: MaV on 14:05, 23 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

MaV

Quote from: ukmarkh on 20:50, 24 April 18Any links
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.
Black Mesa Transit Announcement System:
"Work safe, work smart. Your future depends on it."

andycadley


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).


emilb

#8
Coincidentally that was the first project I picked up after learning the basics of Z80 assembly.


I used a short program calculating the number of primes up to 1000. Not having any other 8-bit machine to test against, I used my PC (AMD Ryzen 5 3600) with an equivalent program written in C++.


Results [drumroll]:

       
  • CPC: 0.16 seconds,
  • PC: 5 microseconds (0.000005 seconds),
so only 32000x difference :D 


If you're interested in the code, you can find it here: https://github.com/emilbogumil/cpc-benchmark

eto

Quote from: ukmarkh on 20:44, 22 April 18and every 8bit Machine in regards to basic

Afaik not the BBC Micro.

Powered by SMFPacks Menu Editor Mod