On Wed, Aug 4, 2010 at 2:06 PM, David Abrahams
On Aug 4, 2010, at 3:22 PM, WB wrote:
Case 3 runs in ~1.8...1.9s, case 1 and 2 in 0.81...0.84s. This is the same ratio I already had (at least I'm not confused about that). So your 0.65s for case 3 is really amazing.
Knowing nothing about your particular code... chances are good that somebody is not measuring what he thinks he's measuring. If you want a sample of the kinds of issues you should consider, have a look at http://github.com/boost-lib/parameter/blob/master/test/efficiency.cpp
Again, try this in phoenix: boost::transform(v, arg1 * 2); The arg1 * 2 creates this same thing: struct anonymousThing { template<typename T> T operator(const T& t) const { return t * 2; } } So the above executes something like this: boost:;transform(v, anonymousThing()); Which the compiler should rather well optimize completely out, at least it always does for me in VC. You can also use _1 in phoenix (*IF* you pull it from the phoenix namespace and you do *NOT* include boost/bind.hpp), but arg1 is better as it is completely unambiguous so you have no worry.