Author Topic: Amstrad CPC Machine code speed test  (Read 3892 times)

0 Members and 1 Guest are viewing this topic.

Offline ukmarkh

  • 6128 Plus
  • ******
  • Posts: 1.470
  • Country: england
    • Classic Replay
    • Awards
Amstrad CPC Machine code speed test
« 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
like
0
No reactions

Online Urusergi

  • CPC6128
  • ****
  • Posts: 254
  • Country: es
    • Awards
Re: Amstrad CPC Machine code speed test
« Reply #1 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
like
0
No reactions

Offline ukmarkh

  • 6128 Plus
  • ******
  • Posts: 1.470
  • Country: england
    • Classic Replay
    • Awards
Re: Amstrad CPC Machine code speed test
« Reply #2 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
like
0
No reactions

Offline MaV

  • Supporter
  • 6128 Plus
  • *
  • Posts: 1.136
  • Country: at
  • Ius summum saepe summa est malitia.
    • Awards
Re: Amstrad CPC Machine code speed test
« Reply #3 on: 14:05, 23 April 18 »
litwr wrote a bunch of machine code programs for various platforms intended for speed comparisons.
like
0
No reactions
Black Mesa Transit Announcement System:
"Work safe, work smart. Your future depends on it."

Online Urusergi

  • CPC6128
  • ****
  • Posts: 254
  • Country: es
    • Awards
Re: Amstrad CPC Machine code speed test
« Reply #4 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)
like
0
No reactions

Offline ukmarkh

  • 6128 Plus
  • ******
  • Posts: 1.470
  • Country: england
    • Classic Replay
    • Awards
Re: Amstrad CPC Machine code speed test
« Reply #5 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
like
0
No reactions

Offline MaV

  • Supporter
  • 6128 Plus
  • *
  • Posts: 1.136
  • Country: at
  • Ius summum saepe summa est malitia.
    • Awards
Re: Amstrad CPC Machine code speed test
« Reply #6 on: 12:07, 25 April 18 »
Any 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.
like
0
No reactions
Black Mesa Transit Announcement System:
"Work safe, work smart. Your future depends on it."

Offline andycadley

  • Supporter
  • 6128 Plus
  • *
  • Posts: 1.029
    • Awards
Re: Amstrad CPC Machine code speed test
« Reply #7 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).

like
0
No reactions

Offline emilb

  • CPC464
  • **
  • Posts: 5
  • Country: de
    • Awards
Re: Amstrad CPC Machine code speed test
« Reply #8 on: 15:18, 07 August 21 »
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
« Last Edit: 15:41, 07 August 21 by emilb »
like
0
No reactions

Offline eto

  • Supporter
  • 6128 Plus
  • *
  • Posts: 568
  • Country: de
    • Awards
Re: Amstrad CPC Machine code speed test
« Reply #9 on: 21:48, 07 August 21 »
and every 8bit Machine in regards to basic

Afaik not the BBC Micro.
like
0
No reactions