Int16 vs Int32

  • Thread starter Thread starter news.austin.rr.com
  • Start date Start date
N

news.austin.rr.com

Do ARM or XScale chips execute Int16 faster than Int32 or do the 32bit
registers handle Int32 faster?

thanks
 
I've not tested, but intuitively I'd say they'll be the same. The MMU will
align them on a DWORD boundary either way, but speed won't be affected.

-Chris
 
Wouldn't result have to be truncated to 16 bit making it a bit (or maybe 16
bit) slower
 
An interesting point - I'm not convinced truncation would have to occur ,
and really this is managed code so I can believe it's significant in any
case. Would be interesting to test though.

-Chris
 
I have noticed that Int32 is a bit faster than Int16. I had this test
for Int32 measurement:

const int Tries = 1000;
private long Test1Int32()
{
Int32 [] aa2 = new Int32[100001];
long total = 0;
for(int a = 0; a < Tries; a++)
{
long l = OpenNETCF.Win32.Core.QueryPerformanceCounter();
for(int i = 0; i < 100000; i++)
{
aa2 = 100;
}
l = OpenNETCF.Win32.Core.QueryPerformanceCounter() - l;
total += l;
}

return total / Tries;
}

and the same test for Int16 array. It seems that "stelem.i2" works
slower than "stelem.i4" and that is why an array with Int16 element is
slower. The same results I had for "Int16Var++" and "Int32Var++" for
this test:

private long Test2Int32()
{
Int32 aa2 = 0;
long total = 0;
for(int a = 0; a < Tries; a++)
{
aa2 = 0;
long l = OpenNETCF.Win32.Core.QueryPerformanceCounter();
for(int i = 0; i < 30000; i++)
{
aa2++;
}
l = OpenNETCF.Win32.Core.QueryPerformanceCounter() - l;
total += l;
}

return total / Tries;
}

Hope this help,
Sergey Bogdanov
http://www.sergeybogdanov.com
 
what chip was the test on?

thanks.

Sergey Bogdanov said:
I have noticed that Int32 is a bit faster than Int16. I had this test
for Int32 measurement:

const int Tries = 1000;
private long Test1Int32()
{
Int32 [] aa2 = new Int32[100001];
long total = 0;
for(int a = 0; a < Tries; a++)
{
long l = OpenNETCF.Win32.Core.QueryPerformanceCounter();
for(int i = 0; i < 100000; i++)
{
aa2 = 100;
}
l = OpenNETCF.Win32.Core.QueryPerformanceCounter() - l;
total += l;
}

return total / Tries;
}

and the same test for Int16 array. It seems that "stelem.i2" works
slower than "stelem.i4" and that is why an array with Int16 element is
slower. The same results I had for "Int16Var++" and "Int32Var++" for
this test:

private long Test2Int32()
{
Int32 aa2 = 0;
long total = 0;
for(int a = 0; a < Tries; a++)
{
aa2 = 0;
long l = OpenNETCF.Win32.Core.QueryPerformanceCounter();
for(int i = 0; i < 30000; i++)
{
aa2++;
}
l = OpenNETCF.Win32.Core.QueryPerformanceCounter() - l;
total += l;
}

return total / Tries;
}

Hope this help,
Sergey Bogdanov
http://www.sergeybogdanov.com


news.austin.rr.com said:
Do ARM or XScale chips execute Int16 faster than Int32 or do the 32bit
registers handle Int32 faster?

thanks
 
It was tested on ARMv4.

Best regards,
Sergey Bogdanov
http://www.sergeybogdanov.com


news.austin.rr.com said:
what chip was the test on?

thanks.

I have noticed that Int32 is a bit faster than Int16. I had this test
for Int32 measurement:

const int Tries = 1000;
private long Test1Int32()
{
Int32 [] aa2 = new Int32[100001];
long total = 0;
for(int a = 0; a < Tries; a++)
{
long l = OpenNETCF.Win32.Core.QueryPerformanceCounter();
for(int i = 0; i < 100000; i++)
{
aa2 = 100;
}
l = OpenNETCF.Win32.Core.QueryPerformanceCounter() - l;
total += l;
}

return total / Tries;
}

and the same test for Int16 array. It seems that "stelem.i2" works
slower than "stelem.i4" and that is why an array with Int16 element is
slower. The same results I had for "Int16Var++" and "Int32Var++" for
this test:

private long Test2Int32()
{
Int32 aa2 = 0;
long total = 0;
for(int a = 0; a < Tries; a++)
{
aa2 = 0;
long l = OpenNETCF.Win32.Core.QueryPerformanceCounter();
for(int i = 0; i < 30000; i++)
{
aa2++;
}
l = OpenNETCF.Win32.Core.QueryPerformanceCounter() - l;
total += l;
}

return total / Tries;
}

Hope this help,
Sergey Bogdanov
http://www.sergeybogdanov.com


news.austin.rr.com said:
Do ARM or XScale chips execute Int16 faster than Int32 or do the 32bit
registers handle Int32 faster?

thanks

 
Back
Top