
On Sat, Oct 30, 2010 at 1:25 PM, Domagoj Saric <dsaritz@gmail.com> wrote:
"Daniel Walker" <daniel.j.walker@gmail.com> wrote in message news:AANLkTi=XyK9WhaKJO8K8y8AAj70WawJU1TqFHgQd35Tk@mail.gmail.com...
Sorry, I must have missed your examples.
e.g. http://lists.boost.org/Archives/boost/2010/01/160908.php
Thanks. I added a tarball, signal_benchmark.tar.bz2, with a jamfile and source code so that anyone who's interested can easily reproduce this benchmark. The benchmark measures the impact of the static empty scheme on the time per call of boost::signals2::signal using the code Domagoj linked to. Thanks to Christophe Prud'homme for the original benchmark! Here are the results I got, again, using the build of g++ 4.2 provided by my manufacturer. Data (Release): | function | function (static empty) time/call | 3.54e-07s | 3.51e-07s space/type | 64B | 80B Data (Debug): | function | function (static empty) time/call | 2.05e-06s | 2.04e-06s space/type | 64B | 80B You can see that removing the empty check from boost::function yields about a 1% improvement in time per call to boost::signal. The increased space per type overhead is the same as before: 16B. So, basically, in the use-case measured by this benchmark the time overhead of boost::function is dwarfed by the combined costs of boost::signal and the target function, and so using the static empty scheme does not yield much benefit. Again, the actual performance will depend on you compiler's optimization, so some users may receive more benefit than others. This is why I think we should give users the chance to test the two schemes in their own applications and choose the one that works best for them. Daniel Walker