# Cycles Per Instruction

Previous topic - Next topic

MrPlow

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

spacefractal

#1
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.
Genius.Greedy Mouse - Karma Miwa - Spot Race - CatchOut - PowerUp Elevation - The beagle Jam - Cave Heroes 2023 - https://spacefractal.itch.io/

MrTAToad

The best you can get is the function profiler...