A
aryan
Hi,
1. which book would you recommend to study performance tuning in c++?
2. which of the functions f1() and f2() perform better?
struct xxx
{
int a;
int b;
};
struct yyy
{
xxx xList[10];
};
void f1()
{
yyy yList1;
yyy yList2;
for (int j =0 ; j = 10 ; j++)
{
if(yList1.xList[j].a < yList2.xList[j].a
and
yList1.xList[j].b > yList2.xList[j].b)
doSomething(yList1.xList[j].a, yList2.xList
[j].b);
}
}
//OR
void f2()
{
yyy yList1;
yyy yList2;
for (int j =0 ; j = 10 ; j++)
{
xxx &x1=yList1.xList[j],
&x2=yList2.xList[j];
if(x1.a < x2.a
and
x1.b > x2.b)
doSomething(x1.a, x2.b)
}
}
thanks.
1. which book would you recommend to study performance tuning in c++?
2. which of the functions f1() and f2() perform better?
struct xxx
{
int a;
int b;
};
struct yyy
{
xxx xList[10];
};
void f1()
{
yyy yList1;
yyy yList2;
for (int j =0 ; j = 10 ; j++)
{
if(yList1.xList[j].a < yList2.xList[j].a
and
yList1.xList[j].b > yList2.xList[j].b)
doSomething(yList1.xList[j].a, yList2.xList
[j].b);
}
}
//OR
void f2()
{
yyy yList1;
yyy yList2;
for (int j =0 ; j = 10 ; j++)
{
xxx &x1=yList1.xList[j],
&x2=yList2.xList[j];
if(x1.a < x2.a
and
x1.b > x2.b)
doSomething(x1.a, x2.b)
}
}
thanks.