Re: g_intern_static_string() for type names as small optimization



On Wed, 2008-01-16 at 12:43 -0500, Matthias Clasen wrote:
> 
> The thing is that GObject interns the type name anyway. But, as you
> say,
> it cannot assume that the string is static and thus calls
> g_intern_string(),
> causing it to be copied. By interning it using
> g_intern_static_string() beforehand,
> we guarantee that the string is already interned at the time that
> gobject calls
> g_intern_string, and thus won't be copied.

One would think that the "_static" in g_type_register_static() means
that it doesn't copy its arguments, but apparently this static is
different...

-- 
behdad
http://behdad.org/

"Those who would give up Essential Liberty to purchase a little
 Temporary Safety, deserve neither Liberty nor Safety."
        -- Benjamin Franklin, 1759



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