Re: g_type_instance_is_a (was Cairo 1.3 performance loss)



On Wed, 2007-01-24 at 17:27 -0800, Daniel Amelang wrote:
> But I can't help but notice in your profiles that g_type_instance_is_a
> takes up 3x the CPU that the tessellator does. And with the old
> tessellator, g_type_instance_is_a takes 9x the CPU the tessellator does.
..
> FYI, top callers (in descending order) of g_type_instance_is_a are:

	So - g_type_instance_is_a should only be slow for interface types
(where it must take a lock).

	Of course, it may well be possible to have a thread-local-storage cache
of type information details. "A is not a B", "B is not an A", "C is a D"
and so on - that might help, though lifecycle is always fun.

> gdk_window_invalidate_maybe_recurse

	presumably from the:

  if (GDK_IS_PAINTABLE (private->impl) &&

	[ also interesting that we call:
	       GDK_PAINTABLE_GET_IFACE (private->impl)->invalidate_maybe_recurse)
	  twice back-to-back, (which takes a mutex) when we should just
	  store the pointer for later use ].

> gdk_window_begin_paint_region

	The same code �cut/pasted there too it seems.

	It seems the Paintable interface is used by the directfb and quartz
backends, but otherwise shouldn't be used; I would imagine it would be
easy to add a flag / method "is_paintable" that could be used instead of
a GInterface check here though.

> gdk_drawable_get_screen

	Strangely this isn't wrt. an interface; perhaps that scuppers the idea
that it's lock taking that is slow:

	g_return_val_if_fail (GDK_IS_DRAWABLE (drawable), NULL);

	OTOH, perhaps this is called millions of times (?). Clearly since there
are only a really small number of drawables, this could have some '?'
operator goodness & special cases for the most common types of drawable.

> gtk_widget_style_get

	similarly, this only calls:

	g_return_if_fail (GTK_IS_WIDGET (widget));

	perhaps it just happens millions of times; odd.

	HTH,

		Michael.	

-- 
 michael meeks novell com  <><, Pseudo Engineer, itinerant idiot





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