This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

byte Vs Half word Vs Word comparison

Hi Experts,

unsigned int var1_32;
unsigned int var2_32;

unsigned short int var1_16;
unsigned short int var2_16;

unsigned char var1_8;
unsigned char var2_8;

In the above declarations which is faster,

if(var1_32 == var2_32)
{

}

or

if(var1_16 == var2_16)
{

}

or

if(var1_8 == var2_8)
{

}
Parents
  • Dave's comments are spot on here. In general, the compiler will do a very good job with what you give it. But some thought into the most efficient/appropriate/suitable data types will give it a lot of help.

    One other reason which occurs to me for using "small" containers is the possibility of getting much more value out of SIMD instructions. The NEON architecture (and to a lesser extend the v6 SIMD extensions) are capable of handling a number of individual data items packed into wide vector registers. The smaller the items are, the more of them you can fit into a vector. This can pay huge dividends if used correctly.

    Chris

Reply
  • Dave's comments are spot on here. In general, the compiler will do a very good job with what you give it. But some thought into the most efficient/appropriate/suitable data types will give it a lot of help.

    One other reason which occurs to me for using "small" containers is the possibility of getting much more value out of SIMD instructions. The NEON architecture (and to a lesser extend the v6 SIMD extensions) are capable of handling a number of individual data items packed into wide vector registers. The smaller the items are, the more of them you can fit into a vector. This can pay huge dividends if used correctly.

    Chris

Children
No data