john_god
31st July 2010, 01:46
Is there a significant performance issues between the next 2 functions ?
void cos(QList<Complexo> &x, QList<Complexo> &y)
{
y.clear();
for(int i=0;i < x.size(); i++)
{
y.append(cos(x[i]));
}
}
QList<Complexo> cos(QList<Complexo> & x)
{
QList<Complexo> y;
for(int i=0;i < x.size(); i++)
{
y.append(cos(x[i]));
}
return y;
}
The second seems more elegant but returning a large QList, will be slower ?
void cos(QList<Complexo> &x, QList<Complexo> &y)
{
y.clear();
for(int i=0;i < x.size(); i++)
{
y.append(cos(x[i]));
}
}
QList<Complexo> cos(QList<Complexo> & x)
{
QList<Complexo> y;
for(int i=0;i < x.size(); i++)
{
y.append(cos(x[i]));
}
return y;
}
The second seems more elegant but returning a large QList, will be slower ?