|
Boost : |
From: Asger Alstrup Nielsen (alstrup_at_[hidden])
Date: 2002-02-27 12:24:04
> What would users prefer? The first option, that would guarantee O(1)
> insertion time for unnamed slots, O(lg n) insertion time for named slots,
but
> complicate (and somewhat slow down) the calling of slots? Or the second
> option, that would guarantee O(lg n) insertion time for all slots but
provide
> a simpler implementation that might be (slightly) more efficient when
calling
> slots?
It's difficult to choose, because I think it does depend on the constant
factor, and other factors.
The maximum number of connections to a signal in my typical usage scenarios is
on the order of hundreds. This is so low a number that the difference between
O(1) and O(log n) in complexity might not be relevant. It comes down to the
constant factors, and O(log n) might beat O(1) in real life.
Additionally, the insertion operation is typically used in start-up code, and
therefore typically not performance-sensitive. However, signaling is more
often used in the inner loops of your program, so I guess this implies that
faster signaling is more important.
I don't know if this favours option 2 all in all, because you have to consider
other factors as well, such as implementation and runtime memory footprint,
complexity of implementation, flexibility, future potentials, reusability and
so on.
Greets,
Asger Alstrup Nielsen
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk