Re: A few comments on GVariant



Hi;

Simon McVittie <simon mcvittie collabora co uk> wrote:
> On Mon, 30 Nov 2009 at 13:27:02 +0100, Christian Persch wrote:
> > - space efficiency: I was trying to build a variant containing some
> >   data, and multiple dicts to get at the data from various keys. i.e
> >   "a{sv}a{sv}a{sv}". I though that if I constructed the data
> >   GVariants first, and then added these to the dicts (i.e.
> >   v=g_variant_new(), add (key1, v) to dict1, add (key2, v) to dict2
> >   etc), the resulting blob (g_variant_flatten
> >   + get the data out) would contain that data only once instead of
> > once for each dict it was in.
> 
> The D-Bus serialization format (which is also the GVariant
> serialization format) doesn't have backreferences to
> previously-serialized data, so yes, your data will get duplicated if
> you do this.
> 
> In practice, the big cost on D-Bus tends to be number of round trips /
> wait-for-reply operations, rather than the number of bytes
> transferred, so a bit of redundancy isn't a big deal.
> 
> I can see that the tradeoffs for storage on disk aren't the same as
> the tradeoffs for D-Bus; but, gzip the blob? :-)

Yes, I tried to use GVariant to store lots of data on disk, to be
mmaped, and not for transfer over dbus or network. So space efficiency
would be good, but by using gzip I would lose the ability to just mmap
the data directly.

Regards,
	Christian


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