
On Monday 03 November 2008 13:31, Michael Marcin wrote:
Frank Mori Hess wrote:
boost::signal, 10 connections, tracking enabled, invoking 1000000 times: 0.78 s
boost::signals2::signal, 10 connections, tracking enabled, invoking 1000000 times: 4.92 s
Over 6 times slower in this case. That seems to warrant some concern.
Almost 2 seconds of the overhead is due to atomic reference counting for shared_ptr. If I compile the benchmark with DISABLE_BOOST_THREADS I get: boost::signals2::signal, 10 connections, tracking enabled, invoking 1000000 times: 3.20 s Probably an similar sized chunk of overhead is due to a heap allocation inside the std::vector used to hold the tracked shared_ptr during invocation. That part is actually something that could be optimized, at least for slots tracking less than some arbitrary fixed number of shared_ptr (say 10).