Boost logo

Boost :

From: Neal Coombes (nealc_at_[hidden])
Date: 2005-01-19 13:13:40


Neal Coombes wrote:
> I also noticed pretty drastic memory performance.

Just enjoyed a long weekend so I couldn't post this sooner. I've
created a small test application that does absolutely nothing but create
signals (a million of them). If passed in "boost", "sigc" or "lite" it
will create a millions signals of the appropriate type. boost and sigc
I think everyone knows about. The lite implementation is the
implementation posted to this list by Jody Hagins on 11/30/04 titled
"Re: [signals] Performance".

The results I've gotten (just from top) are:

boost: 329 MB
sigc: 17 MB
lite: 41 MB

uname -a
SunOS dusty 5.9 Generic_112234-08 i86pc i386 i86pc

Please keep me posted as to if/when this gets fixed. I'm somewhat
disappointed that I have to move to sigc and would like to move back to
boost asap.

Thanks,
Neal

----
#include <iostream>
#include <string>
#include <boost/signal.hpp>
#include <sigc++/signal.h>
#if defined (LITE_SIGNALS)
#include "Signal.hpp"
void lite_test();
std::string const lite_arg("lite");
#endif
using namespace std;
string const boost_arg("boost");
string const sigc_arg("sigc");
int const NUM_SIGNALS = 1000000;
void boost_test();
void sigc_test();
int main(int argc, char **argv)
{
   if(argc == 2) {
     if(sigc_arg == argv[1])
       sigc_test();
     else if(boost_arg == argv[1])
       boost_test();
#if defined (LITE_SIGNALS)
     else if(lite_arg == argv[1])
       lite_test();
#endif
   }
}
void boost_test()
{
   boost::signal<void ()> *sig;
   int i = 0;
   for(; i < NUM_SIGNALS; ++i) {
     sig = new boost::signal<void ()>;
   }
   cin >> i;
}
void sigc_test()
{
   sigc::signal<void> *sig;
   int i = 0;
   for(; i < NUM_SIGNALS; ++i) {
     sig = new sigc::signal<void>;
   }
   cin >> i;
}
#if defined (LITE_SIGNALS)
void lite_test()
{
   lite::signals::Signal<void ()> *sig;
   int i = 0;
   for(; i < NUM_SIGNALS; ++i) {
     sig = new lite::signals::Signal<void ()>;
   }
   cin >> i;
}
#endif

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