BASIC

Author Topic: # Cycles Per Instruction  (Read 1150 times)

Offline MrPlow

  • Prof. Inline
  • *****
  • Posts: 1456
    • View Profile
# Cycles Per Instruction
« on: 2014-Sep-30 »
A thought came to me whilst looking into some z80 assembly code and I think it would be nice to have for GLB...

Can anyone think or devise a way to calc the number of clock cycles or a benchmark equivalent for each main command type? Would such a thing be useful for us coders? Doesn't need  to be perfect just a guideline, some of you may know a lot of this already.

Perhaps the results may differ totally when run on Android or iOS too though...

Drawrect                       xxx ticks
SpritePoly() (polyvector function)     xxx ticks
Setpixel                         xxx ticks
Getpixel                       xxx ticks
Drawsprite
Rotozoomsprite
Drawanim
createscreen
stretchsprite

etc

I suppose if we avoid the most CPU intensive instructions where possible we could optimise our games?
 



Comp:
Speccy-48k, Speccy-128k, Amigas, PCs

Offline spacefractal

  • Community Developer
  • Prof. Inline
  • ******
  • Posts: 3611
    • View Profile
    • Space Fractal
Re: # Cycles Per Instruction
« Reply #1 on: 2014-Sep-30 »
impossible to tell really, since this can been very much variered from platform to platforms. Cpu cycles can really only been used on hardware with fixed specs. Android and iOS example dosent have fixed specs at all example.
« Last Edit: 2014-Sep-30 by spacefractal »
Greedy Mouse - Karma Miwa - Spot Race - CatchOut - Android Extras - is on a vacation trip, home before end of few days in jan.

MrTAToad

  • Guest
Re: # Cycles Per Instruction
« Reply #2 on: 2014-Sep-30 »
The best you can get is the function profiler...