return
Jordi
kde-optimize@mail.kde.org
Mon, 3 Feb 2003 12:59:10 +0100
There's a lot of methods, at least in my code that end ups returning true or
false to tell if they were able to make a small operation in that cases what
will be faster:
A:
bool advance()
{
bool result=true;
if (current_frame== max_frame)
if (cyclic)
current_frame=0;
else
result=false;
else
++current_frame;
return result;
}
or
B:
bool advance()
{
if (current_frame== max_frame)
if (cyclic)
current_frame=0;
else
return false;
else
++current_frame;
return result;
}
In case A a bool has to be allocated in that method but gcc is supposed to
optimize that case.
In case B the bool is get ridden and gcc is supposed to not be able to
optimize that well....
What's faster A or B?
--
Jordi
http://development.bluesock.net