Re: gobject optimization



On Tue, 2002-11-19 at 17:49, Owen Taylor wrote:
> 
> Matthias Clasen <maclas gmx de> writes:
> 
> > I recently looked at some profiles, showing g_type_check_instance_cast
> > in a prominent position. Instrumenting it showed that on testgtk --bench
> > ALL, 1031830 of 3661172 calls or 28.18% are checking an object against
> > its own type. Consequently, doing the same optimization that was done on
> > g_type_check_instance_is_a() and g_type_check_class_is_a() back in July
> > 2001 should have some effect. 
> 
> What debug level was this done at? Stable builds of GLib/GTK+
> are supposed to have -DG_DISABLE_CAST_CHECKS, so cast-check
> time should drop out. 
> 
> To simulate this for unstable series build (like 2.1.x), you should be
> compiling with an explicit --enable-debug=minimum.

Ah, I forgot about that. I used --enable-debug, so the cast checks were
not compiled away.

> 
> [ Pango/ATK don't have --enable-debug logic in place, so probably
>   could use a bit of fixage here ]
> 
> That being said, of course, optimizing the case where we do
> have cast-checks on won't hurt. It would be interesting to measure
> with --enable-debug:
> 
>  - How much adding the optimization helps
>  - How much it increases generated code size
> 
> There are even more cast checks in a typical GTK+ program than
> GTK_IS_FOO() calls, so code size increase might be significant.

I'll try to come up with some numbers.

Matthias





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