g_type_is_a() shortcut (Re: Optimizations)
- From: Tim Janik <timj gtk org>
- To: Stefan Westerfeld <stefan space twc de>
- Cc: beast gnome org
- Subject: g_type_is_a() shortcut (Re: Optimizations)
- Date: Tue Feb 3 14:48:03 2004
On Tue, 3 Feb 2004, Stefan Westerfeld wrote:
> * No patches: performance of the unmodified build.
>
> stefan@luna1:~/src/beast-performance-eval/beast/tests$ perftest
> 0.980416 seconds for 10000 invocations => 10199.751787 invocations/second, 0.000098 sec per invocation
> stefan@luna1:~/src/beast-performance-eval/beast/tests$ ./perftest
> 0.613326 seconds for 10000 invocations => 16304.543860 invocations/second, 0.000061 sec per invocation
>
> * Patch #9: That was just a try - I think we can trivially say that g_type_is_a
> is TRUE if the arguments match. I am not sure if its worth the extra code,
> though.
>
> --- gtype.orig.c 2004-02-03 01:42:50.000000000 +0100
> +++ gtype.c 2004-02-03 01:40:39.000000000 +0100
> @@ -2341,6 +2341,9 @@ g_type_is_a (GType type,
> TypeNode *node, *iface_node;
> gboolean is_a;
>
> + if (type == iface_type)
> + return TRUE;
> +
> node = lookup_type_node_I (type);
> iface_node = lookup_type_node_I (iface_type);
> is_a = node && iface_node && type_node_conforms_to_U (node, iface_node, TRUE, TRUE);
this changes behaviour in that even invalid type ids can succeed an is_a
check. apart from that, this trivial check is what we try to optimize
with the sophisticated macro version in gtype.h (Patch #7 being part
of which), so i don't expect a relevant benefit from this.
>
> Cu... Stefan
---
ciaoTJ
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]