Boost logo

Boost :

From: Christophe Prud'homme (prudhomm_at_[hidden])
Date: 2005-06-18 09:43:37


Dear Boosters

I am using quite intensively boost::signals but I noticed a relatively high
cost. I wrote a small test program that confirmed it with a comparison to
sigc++-2.0. The code has been compiled with g++-3.3 -O3 and this is a very
recent boost cvs snapshot(compiled in release mode). It was run on a
Debian(sid)/GNU/Linux ibm thinkpad T40p (pentium M)

I vary the number of slots (0 to 4) and calls and I have a dummy slot class
and a less dummy slot class to test with.

here are the timings:
==================================================================
call dummy::operator()
#Slots #Calls boost::signals sigc++-2.0 Ratio
     0 100 0 0 nan
     0 1000 0 0 nan
     0 10000 0 0 nan
     0 100000 0.05 0 inf
     0 1000000 0.5 0.01 50
     0 10000000 4.95 0.11 45
     1 100 0 0 nan
     1 1000 0 0 nan
     1 10000 0.01 0.01 1
     1 100000 0.1 0.02 5
     1 1000000 1.08 0.14 7.71429
     1 10000000 10.55 1.34 7.87313
     2 100 0 0 nan
     2 1000 0 0 nan
     2 10000 0.02 0 inf
     2 100000 0.14 0.02 7
     2 1000000 1.45 0.14 10.3571
     2 10000000 14.6 1.46 10
     3 100 0 0 nan
     3 1000 0 0 nan
     3 10000 0.02 0 inf
     3 100000 0.19 0.01 19
     3 1000000 1.84 0.15 12.2667
     3 10000000 18.44 1.53 12.0523
==================================================================
call A::operator()
#Slots #Calls boost::signals sigc++-2.0 Ratio
     0 100 0 0 nan
     0 1000 0.01 0 inf
     0 10000 0 0 nan
     0 100000 0.05 0 inf
     0 1000000 0.48 0.01 48
     0 10000000 4.87 0.11 44.2727
     1 100 0 0 nan
     1 1000 0 0 nan
     1 10000 0.02 0 inf
     1 100000 0.12 0.01 12
     1 1000000 1.15 0.22 5.22727
     1 10000000 11.46 2.17 5.28111
     2 100 0 0 nan
     2 1000 0.01 0 inf
     2 10000 0.01 0.01 1
     2 100000 0.16 0.03 5.33333
     2 1000000 1.61 0.32 5.03125
     2 10000000 16.17 3.14 5.14968
     3 100 0.01 0 inf
     3 1000 0 0 nan
     3 10000 0.02 0 inf
     3 100000 0.21 0.04 5.25
     3 1000000 2.09 0.41 5.09756
     3 10000000 20.83 4.06 5.13054

Am I using boost::signals the wrong way? has boost::signals some added
features that reduce its performance ?

I apologize in advance if it has already been discussed before but I didnot
find a relevant discussion in the archives or on google.

I found some feature comparison here
http://www.3sinc.com/opensource/boost.bind-vs-sigc2.html

For my application the number of calls are typically between 1e6 and 1e8 with
a few slots (1 to 10 ). The cost of boost::signals framework is quite high.

Best regards
C.

-- 
Christophe Prud'homme
Office MA B2 534
CMCS-IACS EPFL
CH-1015 Lausanne, Switzerland
Tel: +41 (0)21 693 25 47
Fax: +41 (0)21 693 43 03



Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk