I noticed in VS2005 you can build for ARM4i, what is that? Is it any faster than building for regular ARM for games? Does an ARM4i exe work on all ARM CPUs?
Has anyone done any benching of code generated by eVC3 and 4 vs VS2005?
I played around with the various build targets in VS2005 but couldn't detect any performance differences.
I noticed though a major speedup of the VS2005 compiler vs. the eVC4 compiler. For floating point intensive code it is still not as good as the Intel compiler but ways better than eVC4...
Daniel
I did some testing and found them to be exactly the same. Although I think something must be wrong with my code as multiplies are faster than adds in some cases? Also I am surprised how fast divides are, they really aren't that slow for floats.
- Code:
AXIM X50V 624MHZ
ARM4 VS2005
int times 16 13 136
int add 125000 tops
int mlt 153846 tops
int div 14706 tops
float times 1185 1178 1691
float add 1688 tops
float mlt 1698 tops
float div 1183 tops
double times 1840 1816 3478
double add 1087 tops
double mlt 1101 tops
double div 575 tops
ARM4 EVC4.0
int times 16 17 145
int add 125000 tops
int mlt 117647 tops
int div 13793 tops
float times 1184 1177 1739
float add 1689 tops
float mlt 1699 tops
float div 1150 tops
double times 1841 1807 3520
double add 1086 tops
double mlt 1107 tops
double div 568 tops
Here is my test code
- Code:
char textlog[2048] = "";
template <class T>
T BenchMark(char* szName, T temp)
{
DWORD dwStartTime = GetTickCount();
T n,m,total1=0;
for(n = 0; n < 1000; n++)
{
for(m = 1; m < 2001; m++)
total1 += n + m;
}
DWORD t1 = GetTickCount() - dwStartTime;
dwStartTime = GetTickCount();
for(n = 0; n < 1000; n++)
{
for(m = 1; m < 2001; m++)
total1 += n * m;
}
DWORD t2 = GetTickCount() - dwStartTime;
dwStartTime = GetTickCount();
for(n = 0; n < 1000; n++)
{
for(m = 1; m < 2001; m++)
total1 += n / m;
}
DWORD t3 = GetTickCount() - dwStartTime;
dwStartTime = GetTickCount();
float mult = 2000000;
// since we are dividing my milliseconds, number is in thousands of operations per second
//strcat(textlog, "tops = thousands of operations per second\n");
char szChar[1024];
sprintf(szChar, "%s times %d %d %d\n", szName, t1, t2, t3);
strcat(textlog, szChar);
sprintf(szChar, "%s add %.0f tops\n", szName, mult/(float)(t1));
strcat(textlog, szChar);
sprintf(szChar, "%s mlt %.0f tops\n", szName, mult/(float)(t2));
strcat(textlog, szChar);
sprintf(szChar, "%s div %.0f tops\n", szName, mult/(float)(t3));
strcat(textlog, szChar);
return total1;
}
// in main
int i;
float f;
double d;
BenchMark("int", i);
BenchMark("float", f);
BenchMark("double", d);
// we only log once at end because file buffer could effect performance
FILE* fp = fopen("bench.txt", "at");
if(fp)
{
fputs(textlog, fp);
fclose(fp);
}
Mults are as fast as adds, except when you use the result immediately after the instruction. Since you are using a separate loop counter, the add and branch probably waste enough time to keep it from stalling.
With floating point it is all software routines, so division is likely as fast as multiplication.
Dan East
drgoldie wrote:I played around with the various build targets in VS2005 but couldn't detect any performance differences.
I noticed though a major speedup of the VS2005 compiler vs. the eVC4 compiler. For floating point intensive code it is still not as good as the Intel compiler but ways better than eVC4...
Daniel
Does anyone know where you can download the Intel compiler or have it?
The compiler used to be on the Intel webpage. I can not find it anymore. Either they removed it because they sold the complete XScale unit to Marvel or it is part of the C++ compiler suite now. I don't remember anymore...
Daniel
mm40, isn't that the Thumb instruction set?
Did you set the floating point mode to fast rather than precise?
Also you'd want to test more complex expressions since a good compiler will be able to simplify stuff, remove shifts etc.
Yes it was set to fast, although the general setting wasn't set to optimize for speed, tried it again with all optimizations possible and still ended up with the same results though. It probably would make a slight difference in a huge game, but I doubt any more than evc4 which is what I was trying to figure out.