Questions about xdt-csource
Nick Schermer
nickschermer at gmail.com
Mon Oct 17 16:00:37 CEST 2011
On Mon, Oct 17, 2011 at 1:43 AM, Matthew Brush <mbrush at codebrainz.ca> wrote:
> Hi All,
>
> In Geany[1] we are working on converting the interface from Glade 2
> generated code to GtkBuilder/Glade 3 and I was thinking we could use
> xdt-csource or at least a similar technique. I mentioned it to some of the
> Geany devs and they had a couple valid concerns I wanted to ask about here.
>
> The first concern was that embedding such a long string literal into the
> source was not portable since the C90 and C99 standards only guarantee
> support for a maximum string literal length of 509[2] and 4095[3]
> characters, respectively.
The string of the preferences dialog in xfce4-panel is 28700u and I've
never head of any problems. Object size limit is 65535 btw and I think
that's the one in question here.
> The second concern was the extra memory used by having the string containing
> the XML data always stuck in memory, as opposed to having it read from a
> file and then freed immediately once the GtkBuilder/GtkUIManager has parsed
> it.
IIRC content of the .DATA section is mmap-ed during startup, you can
do the same for the xml file. Doubt memory size is an issue here
(0.027 Mb for 28700 chars?)
> So I was wondering if anyone could comment on whether, given the above, it's
> still worth using xdt-csource to speed up startup time and simply
> distribution for a program like Geany.
Xdt-csource also strips the xml, which should improve processing, but
I don't think you'll notice a difference, constructing the widgets is
by far slower.
That said, if you want a fast interface: use gtk directly and build it
yourself. For preferences dialogs it only "guarantees" the content is
available and quickly accessible (disk fragmentation wise).
Nick
More information about the Xfce4-dev
mailing list