
Vladimir Prus wrote:
Alex Besogonov wrote:
Vladimir Prus wrote:
This optimization will make boost::function _much_ faster - in one of How much faster, exactly? Recently, in a thread "[signal] performance" I've posted a small benchmark that finds boost::function to take 4 times more time that call via function pointer -- which, IMO, is pretty fast.
I don't have any problem with boost::function speed of invocations (though FastDelegate is two times faster).
I see. Still, would be nice to see specific numbers.
I like timing the copy contructor of various types. :-) 8M push_back operations in an unreserved vector for: shared_ptr: 1.6 function<> holding a function pointer: 1.6 POD with size 64: 4.9 function<> holding a trivial function object: 17.6 So, assuming that function<> is more frequently used with function objects, SBO would be a win even for size 128. This is with a "bad" ::operator new (the one from MSVC 7.1 MT lib), but still...