Proposal for library addition: faster signals/slots, reactor, atomics

Hello everyone I have written a small library providing: - a (thread-safe) signal/slot implementation - poll/timer/reactor implementation - atomic operations modelled after the proposed C++0x standard (x86 32/64 bit, ppc, alpha, more if someone donates hardware; fallback implementation using locks) Currently I am reworking the library to be more closely tied to and better reuse services provided by Boost. Obviously, there is considerable functional overlap with Boost.Signal/Boost.Signals2 and Boost.Asio, however what sets my implementation apart is that it is considerably faster, measurable in both synthetic tests and real-world applications (the main way this is achieved is through extensive use of atomic operations and carefully designed accessor protocols instead of locking, there is a small documentation section explaining the technique). The signal/slot implementation is thread-safe, with the same guarantees as Boost.Signals2, but about 3 times as fast as (thread-unsafe) Boost.Signal (!) and about 6 times as fast as (thread-safe) Boost.Signals2. The reactor implementation is obviously only suitable for Unix-like systems, while the proactor interface provided by Boost.Asio is a nice and portable abstraction. However, my reactor implementation is about 2-3 times as fast on Unix-like systems for typical network-server-style apps. Moreover I have always found Boost.Asio to be difficult to integrate with third party libraries (think ALSA or ldap) and frameworks (think Qt, Glib), so other developers not interested in portability may also prefer a bare reactor implementation. If you are interested, I invite you to have a look at: http://www.chaoticmind.net/~hcb/projects/libtscb Maybe parts of the library might be interesting for Boost? In particular the atomic operations could be salvaged and provide a "transitional" implementation internal to boost as an interim solution until compiler vendors catch up with C++0x, and I would also like to propose the reactor as a higher-performance alternative to Boost.Asio (my signal/slot implementation lacks combiners and other features provided by Boost.Signals2). Best regards Helge Bahmann

On Mon, Nov 23, 2009 at 4:01 PM, Helge Bahmann <hcb@chaoticmind.net> wrote:
Hello everyone
I have written a small library providing:
- a (thread-safe) signal/slot implementation - poll/timer/reactor implementation - atomic operations modelled after the proposed C++0x standard (x86 32/64 bit, ppc, alpha, more if someone donates hardware; fallback implementation using locks)
Currently I am reworking the library to be more closely tied to and better reuse services provided by Boost. Obviously, there is considerable functional overlap with Boost.Signal/Boost.Signals2 and Boost.Asio, however what sets my implementation apart is that it is considerably faster, measurable in both synthetic tests and real-world applications (the main way this is achieved is through extensive use of atomic operations and carefully designed accessor protocols instead of locking, there is a small documentation section explaining the technique).
The signal/slot implementation is thread-safe, with the same guarantees as Boost.Signals2, but about 3 times as fast as (thread-unsafe) Boost.Signal (!) and about 6 times as fast as (thread-safe) Boost.Signals2.
The reactor implementation is obviously only suitable for Unix-like systems, while the proactor interface provided by Boost.Asio is a nice and portable abstraction. However, my reactor implementation is about 2-3 times as fast on Unix-like systems for typical network-server-style apps. Moreover I have always found Boost.Asio to be difficult to integrate with third party libraries (think ALSA or ldap) and frameworks (think Qt, Glib), so other developers not interested in portability may also prefer a bare reactor implementation.
If you are interested, I invite you to have a look at:
http://www.chaoticmind.net/~hcb/projects/libtscb
Maybe parts of the library might be interesting for Boost? In particular the atomic operations could be salvaged and provide a "transitional" implementation internal to boost as an interim solution until compiler vendors catch up with C++0x, and I would also like to propose the reactor as a higher-performance alternative to Boost.Asio (my signal/slot implementation lacks combiners and other features provided by Boost.Signals2).
As long as it is all fully compatible with VisualStudio8 (2005 SP1), I would be quite ecstatic to use this. I use a lot of atomic operations to make many things lock-less, and having it be a library is useful, and a reactor design would also very very nice to have, especially with speed enhancements, and ditto with signal.

Helge Bahmann wrote:
Hello everyone
I have written a small library providing:
- a (thread-safe) signal/slot implementation - poll/timer/reactor implementation - atomic operations modelled after the proposed C++0x standard (x86 32/64 bit, ppc, alpha, more if someone donates hardware; fallback implementation using locks)
<snip>
If you are interested, I invite you to have a look at:
http://www.chaoticmind.net/~hcb/projects/libtscb
Maybe parts of the library might be interesting for Boost? In particular the atomic operations could be salvaged and provide a "transitional" implementation internal to boost as an interim solution until compiler vendors catch up with C++0x, and I would also like to propose the reactor as a higher-performance alternative to Boost.Asio (my signal/slot implementation lacks combiners and other features provided by Boost.Signals2).
Hi, I have added your library on the LibrariesUnderConstruction wiki page (https://svn.boost.org/trac/boost/wiki/LibrariesUnderConstruction#tscb). The link you done point to the documentation. Could you gibe a link to download the library? I think everyone is interested in having an implementation, even a partial one, of the standard atomic library. There are a lot of internal implementation on the Boost libraries (SmartPtr, Thread, Task between others), maybe you can federate this implementation. Concerning the Signal/Slot implementation it would be worthwhile to extract it in a separated one. If the performances you announce are correct, I think you will have a lot of people interested in. Best, Vicente -- View this message in context: http://old.nabble.com/Proposal-for-library-addition%3A-faster-signals-slots%... Sent from the Boost - Dev mailing list archive at Nabble.com.

Vicente Botet Escriba wrote:
Helge Bahmann wrote:
Hello everyone
I have written a small library providing:
- a (thread-safe) signal/slot implementation - poll/timer/reactor implementation - atomic operations modelled after the proposed C++0x standard (x86 32/64 bit, ppc, alpha, more if someone donates hardware; fallback implementation using locks)
<snip>
If you are interested, I invite you to have a look at:
http://www.chaoticmind.net/~hcb/projects/libtscb
Maybe parts of the library might be interesting for Boost? In particular the atomic operations could be salvaged and provide a "transitional" implementation internal to boost as an interim solution until compiler vendors catch up with C++0x, and I would also like to propose the reactor as a higher-performance alternative to Boost.Asio (my signal/slot implementation lacks combiners and other features provided by Boost.Signals2).
Hi,
The link you give points to the documentation. Could you gibe a link to download the library?
Sorry for the noise. I see it now. Vicente -- View this message in context: http://old.nabble.com/Proposal-for-library-addition%3A-faster-signals-slots%... Sent from the Boost - Dev mailing list archive at Nabble.com.

Am Tuesday 24 November 2009 15:18:41 schrieb Vicente Botet Escriba:
I think everyone is interested in having an implementation, even a partial one, of the standard atomic library. There are a lot of internal implementation on the Boost libraries (SmartPtr, Thread, Task between others), maybe you can federate this implementation.
with pleasure
Concerning the Signal/Slot implementation it would be worthwhile to extract it in a separated one. If the performances you announce are correct, I think you will have a lot of people interested in.
getting rough numbers is as easy as: tscb::signal<void(size_t)> sig; sig.connect(boost::bind(...)); for(size_t n=0; n<1000000; n++) sig(n); replace with boost::signal/signal2 as appropriate if you try this on non-x86 the performance difference is even greater Best regards Helge

Helge Bahmann wrote:
Hello everyone
I have written a small library providing:
- a (thread-safe) signal/slot implementation - poll/timer/reactor implementation - atomic operations modelled after the proposed C++0x standard (x86 32/64 bit, ppc, alpha, more if someone donates hardware; fallback implementation using locks)
I'm not really interested in the signals/slots implementation or the reactor, but I'm very interested in an implementation of the C++0x standard atomics. I encourage you to split the atomics from the other parts of the library, since they will be useful in many more contexts (including other Boost libraries). --Jeffrey Bosboom

-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On 11/25/2009 05:12 AM, Jeffrey Bosboom wrote:
Helge Bahmann wrote:
Hello everyone
I have written a small library providing:
- a (thread-safe) signal/slot implementation - poll/timer/reactor implementation - atomic operations modelled after the proposed C++0x standard (x86 32/64 bit, ppc, alpha, more if someone donates hardware; fallback implementation using locks)
I'm not really interested in the signals/slots implementation or the reactor, but I'm very interested in an implementation of the C++0x standard atomics. I encourage you to split the atomics from the other parts of the library, since they will be useful in many more contexts (including other Boost libraries).
a boost implementation of the c++0x atomic library would greatly simplify my proposed boost.lockfree library tim - -- tim@klingt.org http://tim.klingt.org Art is either a complaint or do something else John Cage quoting Jasper Johns -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (GNU/Linux) iEYEARECAAYFAksNIc8ACgkQdL+4qsZfVsuKvACfUxdU0fgeCYKa5mDzisRJn74/ Nr0Amwb2cyeTBmJnmD0yoOxD0PS/02sA =mljR -----END PGP SIGNATURE-----

Jeffrey Bosboom wrote:
Helge Bahmann wrote:
Hello everyone
I have written a small library providing:
- a (thread-safe) signal/slot implementation - poll/timer/reactor implementation - atomic operations modelled after the proposed C++0x standard (x86 32/64 bit, ppc, alpha, more if someone donates hardware; fallback implementation using locks)
I'm not really interested in the signals/slots implementation or the reactor, but I'm very interested in an implementation of the C++0x standard atomics. I encourage you to split the atomics from the other parts of the library, since they will be useful in many more contexts (including other Boost libraries).
+1, absolutely.
participants (6)
-
Andrey Semashev
-
Helge Bahmann
-
Jeffrey Bosboom
-
OvermindDL1
-
Tim Blechmann
-
Vicente Botet Escriba