libeggdbus v. libdbus-glib



You wrote:
> * From: David Zeuthen <david fubar dk>
> * To: gtk-devel-list gnome org
> * Subject: EggDBus
> * Date: Sun, 21 Dec 2008 21:48:25 -0500
>
> Hey,
>
> For the past 5 weeks or so, I've been working on a new (as compared to
> dbus-glib) D-Bus binding for GObject. The work on this has finally
> reached a stage where the code sufficiently complete and documented so I
> thought I'd send some mail describing it. The code is here

> http://cgit.freedesktop.org/~david/eggdbus

Nine months later, some packages already started to use libeggdbus.

For example, PolicyKit. I got curious (or maybe "appalled") by the number
of libraries this "simple password prompter lib" pulls in,
so I looked at it.

Aside form much other stuff which is not relevant to this email,
it pulls in libeggdbus directly, and libdbus-glib indirectly:

# ldd /usr/lib64/libpolkit-gobject-1.so.0
...
	libeggdbus-1.so.0 => /usr/lib64/libeggdbus-1.so.0 (0x00007fbf5c314000)
...
	libdbus-glib-1.so.2 => /usr/lib64/libdbus-glib-1.so.2 (0x00007fbf5b3a1000)
...

which made me wonder, how come a replacement for libdbus-glib
and libdbus-glib itself live in the same program. Ain't that
code duplication? Let's see why...

readelf -a says that libdbus-glib-1 is not directly used
by libpolkit-gobject:

Dynamic section at offset 0x1fb50 contains 26 entries:
  Tag        Type                         Name/Value
 0x0000000000000001 (NEEDED)             Shared library: [libeggdbus-1.so.0]
 0x0000000000000001 (NEEDED)             Shared library: [libgio-2.0.so.0]
 0x0000000000000001 (NEEDED)             Shared library: [libgobject-2.0.so.0]
 0x0000000000000001 (NEEDED)             Shared library: [libgmodule-2.0.so.0]
 0x0000000000000001 (NEEDED)             Shared library: [libglib-2.0.so.0]
 0x0000000000000001 (NEEDED)             Shared library: [libc.so.6]
 0x000000000000000e (SONAME)             Library soname:
[libpolkit-gobject-1.so.0]

It is apparently pulled in by libeggdbus:

# ldd /usr/lib64/libeggdbus-1.so.0
	linux-vdso.so.1 =>  (0x00007fffe85ff000)
	libgio-2.0.so.0 => /lib64/libgio-2.0.so.0 (0x00007fa5b6355000)
	libgmodule-2.0.so.0 => /lib64/libgmodule-2.0.so.0 (0x00007fa5b6152000)
	libdbus-glib-1.so.2 => /usr/lib64/libdbus-glib-1.so.2 (0x00007fa5b5f30000)
	libdbus-1.so.3 => /lib64/libdbus-1.so.3 (0x00007fa5b5cf2000)
	libpthread.so.0 => /lib64/libpthread.so.0 (0x00007fa5b5ad6000)
	librt.so.1 => /lib64/librt.so.1 (0x00007fa5b58cd000)
	libgobject-2.0.so.0 => /lib64/libgobject-2.0.so.0 (0x00007fa5b5686000)
	libglib-2.0.so.0 => /lib64/libglib-2.0.so.0 (0x00007fa5b53a0000)
	libc.so.6 => /lib64/libc.so.6 (0x00007fa5b5031000)
	libdl.so.2 => /lib64/libdl.so.2 (0x00007fa5b4e2d000)
	libresolv.so.2 => /lib64/libresolv.so.2 (0x00007fa5b4c14000)
	libselinux.so.1 => /lib64/libselinux.so.1 (0x00007fa5b49f5000)
	libcap.so.2 => /lib64/libcap.so.2 (0x00007fa5b47f1000)
	/lib64/ld-linux-x86-64.so.2 (0x00007fa5b6871000)
	libattr.so.1 => /lib64/libattr.so.1 (0x00007fa5b45ec000)

readelf -a:

Dynamic section at offset 0x46768 contains 29 entries:
  Tag        Type                         Name/Value
 0x0000000000000001 (NEEDED)             Shared library: [libgio-2.0.so.0]
 0x0000000000000001 (NEEDED)             Shared library: [libgmodule-2.0.so.0]
 0x0000000000000001 (NEEDED)             Shared library: [libdbus-glib-1.so.2]
 0x0000000000000001 (NEEDED)             Shared library: [libdbus-1.so.3]
 0x0000000000000001 (NEEDED)             Shared library: [libpthread.so.0]
 0x0000000000000001 (NEEDED)             Shared library: [librt.so.1]
 0x0000000000000001 (NEEDED)             Shared library: [libgobject-2.0.so.0]
 0x0000000000000001 (NEEDED)             Shared library: [libglib-2.0.so.0]
 0x0000000000000001 (NEEDED)             Shared library: [libc.so.6]
 0x000000000000000e (SONAME)             Library soname: [libeggdbus-1.so.0]


So, your "new D-Bus binding for GObject" is making programs
use both at once anyway. Also, it is more than twice as big
as libdbus-glib just by itself:

# size /usr/lib64/libeggdbus-1.so.0
   text	   data	    bss	    dec	    hex	filename
 281912	  10776	    504	 293192	  47948	/usr/lib64/libeggdbus-1.so.0

# size /usr/lib64/libdbus-glib-1.so.2
   text	   data	    bss	    dec	    hex	filename
 128367	   4612	    328	 133307	  208bb	/usr/lib64/libdbus-glib-1.so.2


I do not know, maybe it presents some significantly nicer C interface
for the programmer, but on code size front it does not look good.

Sorry for intruding into your time and basically saying
that you write bloated code, but I wanted to make you aware
of this aspect too.

Feel free to ignore this email if you don't care.
--
vda


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]