gbadev.org forum archive

This is a read-only mirror of the content originally found on forum.gbadev.org (now offline), salvaged from Wayback machine copies. A new forum can be found here.

Beginners > Getting Reliable Profiling

#137657 - biubid_boy - Tue Aug 14, 2007 2:45 pm

Hello everyone.
I have created a software division routine in C, which basically divides by multiplying a number by (1/x) in 20.8 fixed point. I now want to compare it to the standard software division. Using the profiling functions found in TONC, I timed the routine running 10 times, then timed ten regular divisions. The results were:
QUICKDIV : 297
SOFTDIV : 2324
Where quickdiv is my routine and softdiv is the division operator in devkitARM. The results are too good to be accurate, aren't they? So what's up?
Thanks in advance,
Biubid_boy.

#137781 - Miked0801 - Wed Aug 15, 2007 6:23 pm

Nope, this looks right. In order of slowest to fastest for divides on GBA:

Thumb GCC call - roughly 300-700 cycles
BIOS Div - 40-150 cycles
ARM IWRAM unrolled div - 10-70 cycles
Big table based reciprical multiply - around 10 cycles flat.

I did an actual exact profile of this 2-3 years ago and posted the results here - these cycle counts I'm pulling from memory so they aren't going to be exact. Still, if you need to do divides a whole bunch (texture mapping), a reciprical table is the fastest.

#137785 - Miked0801 - Wed Aug 15, 2007 6:48 pm

Here's the thread

http://forum.gbadev.org/viewtopic.php?t=3692