Boost logo

Boost Users :

From: Peng Yu (pengyu.ut_at_[hidden])
Date: 2007-09-27 11:38:41


Hi,

It is mentioned at
http://www.boost.org/libs/tuple/doc/tuple_users_guide.html#performance
that the following two ways would be different in term of performance.

//////////////
void f1(int&, double&);
tuple<int, double> f2();

//Then, the call #1 may be slightly faster than #2 in the code below:

int i; double d;
  ...
f1(i,d); // #1
tie(i,d) = f2(); // #2
///////////////////

What about the current commonly used compiler, such as GCC? Are #1 and
#2 different in GCC?

Does the compiler always have some way to optimize #2 to make it as
good as #1? Is it just a matter of fact whether the optimization
method is implemented?

Or #2 can never be made as good as #1?

Thanks,
Peng


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net