
I just wanted to ping Doug to see if there are any updates on the performance of signals. I also noticed pretty drastic memory performance. Although I haven't benchmarked it thoroughly, I decided to rip out our systems current observer pattern and replace it with signals. For our more ubiquitous app, the memory consuption rose from 110 MB to 350 MB. Even after lazily instantiating Signals through scoped_ptr so they only exist if their specifically connected to, the memory consuption was still at 240MB. (This is all using boost-1.31, gcc-3.3.2, Solaris 9). While I try to figure out where all this memory is being used: Has anyone had any experience with using numerous signals in a large system and found any technique for reducing the impact on memory? Thanks, Neal

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
participants (1)
-
Neal Coombes