Hi all,I want to use Vala and Dbus for a project in which I need to exchange information between objects about 4 Hz . The final target is to run the software on an embedded device (with a limited CPU / RAM) I performed some tests and I noticed that using Vala instead of plain C requires significantly more CPU requirements.
The test:- A dbus server with 200 objects registered. Each object sends the following signals:
signalA: a double value with a frequency of 4 Hz
signalB: a double value every 2 seconds
- A client subscribed to 'signalA'
- A client subscribed to 'signalB'
I have obtained the following results (% CPU used):
vala-test-1 (code based on https://live.gnome.org/Vala/DBusServerSample )
13.3% dbus-test-server
18.0% dbus-test-clientA
17.3% dbus-test-clientB
vala-test-2 (Server using method emit_signal . Clients using method
signal_subscribe)
13.3% dbus-test-server
15.3% dbus-test-clientA
1.9 % dbus-test-clientB
Plain C (based on http://www.matthew.ath.cx/misc/dbus):
2.6% dbus-test-server
2.8% dbus-test-client newSignalA
2.6% dbus-test-client newSignalB
Environment: Intel(R) Core(TM)2 Quad CPU Q8200 @ 2.33GHz / 4GB RAM /
OpenSuse 11.4 64bits
In vala, using 'signal_subscribe' instead of 'connect' saves lot of CPU.
Why?
Any point/thought about this would be very appreciated. Thanks in advance, Borja
Attachment:
vala-dbus-performance-tests.tar.gz
Description: application/gunzip