
Tobias Schwinger wrote:
Doug Gregor wrote:
On Sep 14, 2007, at 4:05 PM, Michael Marcin wrote:
I ran across http://www.codeproject.com/cpp/fastdelegate2.asp the other day. I searched the archives and didn't find any discussion about it on the list.
It makes some good arguments and seems to be done pretty well, although it may have succumb to a bit of feature creep.
Should those benchmarks be reran against the trunk version of Boost.Function? Yes, those tests should certainly be rerun now that Boost.Function does the small-object optimization. Copy performance for such small objects is much, much improved.
I once hacked a quick benchmark to compare dispatch times of Bind&Function (1.34 versions) vs. FastDelegate.
With an inlineable replacement for 'boost::mem_fn' (accepting the member function pointer as a non-type template argument)
FastDelegate turned out to be (not quite) twice as fast as Function&Bind with MSVC, which isn't that much IMO held against the lost flexibility, such as not being able to use arbitrary function objects and only binding 'this'.
However, things looked quite a bit worse with GCC (version 4 IIRC, don't remember the exact numbers), a good chunk of it because of not-optimized compile-time const member pointers.
So FastDelegate is still be several times faster when it comes to member function pointers that are runtime values...
There are several fast delegates floating around. I saw discussion in the archives about: http://www.codeproject.com/cpp/fastdelegate.asp but not http://www.codeproject.com/cpp/fastdelegate2.asp which is completely different AFAIK. Which did you compare against before? Thanks, Michael Marcin