Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why do integers process faster than bytes on NDS?

i've noticed that my nds application works a little faster when I replace all the instances of bytes with integers. all the examples online put u8/u16 instances whenever possible. is there a specific reason as to why this is the case?

like image 647
John Liu Avatar asked Jul 09 '12 19:07

John Liu


People also ask

Is Long Long faster than int?

There are too many variables to know for sure how well your program will perform using long by default instead of int. There are reasons why it could be faster and reasons why it could be slower. It could be a total wash. The typical thing to do is to just use int if you don't care about the size of the integer.


1 Answers

The main processor the Nintendo DS utilizes is ARM9, a 32-bit processor.

Reference: http://en.wikipedia.org/wiki/ARM9

                    

Typically, CPU will conduct operations in word sizes, in this case, 32-bits. Depending on your operations, having to convert the bytes up to integers or vice-versa may be causing additional strain on the processor. This conversion and the potential lack of instructions for values other than 32-bit integers may be causing the lack of speed.

like image 195
Daniel Li Avatar answered Oct 21 '22 03:10

Daniel Li