Re: shortcuts for g_type_register_static_simple



On Tue, 8 May 2007, Stefan Kost wrote:

Hi,

I was reffering to the idea Matthis Clasen mentioned in this thread:
http://mail.gnome.org/archives/gtk-devel-list/2006-April/msg00169.html

I look at my own application. Refdbg tells me that I use 162 different types. So the overhead seems to be acceptable. Running oprofile shows these two top in the report for libgobject which itself has 7 % of the total time.
168      11.2299  g_type_check_instance_is_a
118       7.8877  g_type_is_a

yeah, known bottlenecks. the issue with those two functions is really that they
are being called from an insane amount of places. we've tried to squeeze best
performance out of those already (normal type is_a checks are O(1), interface
type is_a checks are O(ld(n_ifaces_per_type))). there don't seem to be any easy
fruits left in here.
we've even implemented obvious call reductions here already, e.g. see the
__r = TRUE branch in the implementation of G_TYPE_CHECK_INSTANCE_TYPE():

#  define _G_TYPE_CIT(ip, gt)             (G_GNUC_EXTENSION ({ \
  GTypeInstance *__inst = (GTypeInstance*) ip; GType __t = gt; gboolean __r; \
  if (__inst && __inst->g_class && __inst->g_class->g_type == __t) \
    __r = TRUE; \
  else \
    __r = g_type_check_instance_is_a (__inst, __t); \
  __r; \
}))

Nothing big to gain here, so it seems.

Stefan

---
ciaoTJ



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