Probably a silly question, but has anyone performed benchmarks on using a std::for_each(begin, end, bind(&C::f, _1)); compared to the hand written loop? Under the debugger I see bind adds a 4 or 5 stack frames between the for_each frame and the C::f frame, so I'm wondering if there is any overhead in these? I could bench it for myself on my everyday compiler for my one task, but surely this was considered and is documented somewhere, much more extensively I'll ever can, no? Some boost libraries discuss performance, but I didn't such a section in the Boost.Bind doco. Thanks for pointers or insights, --DD
Dominique Devienne:
Probably a silly question, but has anyone performed benchmarks on using a std::for_each(begin, end, bind(&C::f, _1)); compared to the hand written loop? Under the debugger I see bind adds a 4 or 5 stack frames between the for_each frame and the C::f frame, so I'm wondering if there is any overhead in these?
It depends (heavily) on the amount of inlining the compiler does. In the
simple case of
#include
participants (2)
-
Dominique Devienne
-
Peter Dimov