Re: Some performance notes
- From: Tim Janik <timj gtk org>
- To: Owen Taylor <otaylor redhat com>
- Cc: Gtk+ Developers <gtk-devel-list gnome org>
- Subject: Re: Some performance notes
- Date: Mon, 6 Aug 2001 04:16:28 +0200 (CEST)
On 5 Aug 2001, Owen Taylor wrote:
> So, without including hard data (I don't have much), here are
> my observations:
>
> * The GTK_IS_FOO() and GTK_FOO() debugging checks are hitting
> us pretty hard right now. The overhead of this is somewhere
> around 30%, which is a lot more than than it was in
> GTK+-1.2.
erk, i noticed that i didn't- as i thought i had -commit the
gcc-specific instance and class checks recently. so you might want
to check these 30% again with applying the appended patch first
(i'm currently hacking interfaces in gtype.[hc] so i'll take a couple
more days untill this goes into CVS).
> I would like to get the overhead of debugging down to the point where
> we can ship with --enable-debug=minimum as we did for GTK+-1.2, but if
> necessary we can go with --disable-debug for production builds and
> just encourage developers to use --enable-debug versions.
did you get any hard numbers that would indicate we should really ship
with --disable-debug instead of --enable-debug=minimum? i wonder what
extra noticable impact minimum over none should have.
> If we can cut down the signal overhead some, and do a bit of work at
> the top of the remaining profile, I think we'll do nicely.
some is definitely doable with hard-coding some GValue extractions
in the marshallers at the cost of bloating their code size, i doubt
we can do much for the gsignal.c core though, as i tried to keep the
code as fast as possible in there.
>
> Regards,
> Owen
>
>
---
ciaoTJ
Index: gtype.h
===================================================================
RCS file: /cvs/gnome/glib/gobject/gtype.h,v
retrieving revision 1.29
diff -u -u -r1.29 gtype.h
--- gtype.h 2001/07/02 05:02:13 1.29
+++ gtype.h 2001/08/06 02:07:07
@@ -367,12 +367,31 @@
# define _G_TYPE_CCC(cp, gt, ct) ((ct*) cp)
#endif /* G_DISABLE_CAST_CHECKS */
#define _G_TYPE_CHI(ip) (g_type_check_instance ((GTypeInstance*) ip))
-#define _G_TYPE_CIT(ip, gt) (g_type_instance_is_a ((GTypeInstance*) ip, gt))
-#define _G_TYPE_CCT(cp, gt) (g_type_class_is_a ((GTypeClass*) cp, gt))
#define _G_TYPE_CVH(vl, gt) (g_type_check_value_holds ((GValue*) vl, gt))
#define _G_TYPE_CHV(vl) (g_type_check_value ((GValue*) vl))
#define _G_TYPE_IGC(ip, gt, ct) ((ct*) (((GTypeInstance*) ip)->g_class))
#define _G_TYPE_IGI(ip, gt, ct) ((ct*) g_type_interface_peek (((GTypeInstance*) ip)->g_class, gt))
+#ifdef __GNUC__
+# define _G_TYPE_CIT(ip, gt) ({ \
+ 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_instance_is_a (__inst, __t); \
+ __r; \
+})
+# define _G_TYPE_CCT(cp, gt) ({ \
+ GTypeClass *__class = (GTypeClass*) cp; GType __t = gt; gboolean __r; \
+ if (__class && __class->g_type == __t) \
+ __r = TRUE; \
+ else \
+ __r = g_type_class_is_a (__class, __t); \
+ __r; \
+})
+#else /* !__GNUC__ */
+# define _G_TYPE_CIT(ip, gt) (g_type_instance_is_a ((GTypeInstance*) ip, gt))
+# define _G_TYPE_CCT(cp, gt) (g_type_class_is_a ((GTypeClass*) cp, gt))
+#endif /* !__GNUC__ */
#define G_TYPE_FLAG_RESERVED_ID_BIT (1 << 30)
extern GTypeDebugFlags _g_type_debug_flags;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]