Boost logo

Boost :

From: Doug Gregor (dgregor_at_[hidden])
Date: 2005-02-11 11:34:18

On Feb 11, 2005, at 9:51 AM, Peter Dimov wrote:

> Douglas Gregor wrote:
>> Background: Signals performance is sub-par, and much of the problem
>> can be traced back to support for named slot groups. I'm trying to
>> determine the best way to proceed.
> Are you sure that this is the case?

There may be other issues, but going from a std::list to a std::map (as
needed to efficiently support connection of named slots) hurts
iteration performance and increases executable code size. To counter
the latter problem, I've done some type erasure that slows it down
further and causes some of the extra heap allocations :(

> To handle disconnection correctly, one needs to invoke a temporary
> list<>. I haven't looked at what boost::signal does, but this may
> account for the dynamic allocations that have been reported.

It's not quite that bad in Signals; there's a boolean flag in each
connection that checks whether the slot has been disconnected. If we're
in the process of invoking slots (recursively), disconnection merely
marks the slot as having been removed. Once the top-level signal
invocation completes, it scans the slot list to remove any slots that
were marked as disconnected. This does hurt iteration performance
(because we have to skip over disconnected slots) and slots down the
top-level invocation slightly (because the list is rescanned).


Boost list run by bdawes at, gregod at, cpdaniel at, john at