gsignal: Use new G_VALUE_COLLECT_INIT variant
authorEdward Hervey <bilboed@bilboed.com>
Wed, 2 Dec 2009 10:49:49 +0000 (11:49 +0100)
committerAlexander Larsson <alexl@redhat.com>
Wed, 13 Jan 2010 09:16:48 +0000 (10:16 +0100)
Makes g_signal_emit_valist from 15% to 20% faster.

Results reported from profiling the pan newsreader which uses a variant
of simple and complex signal emissions (i.e no args or various args)

https://bugzilla.gnome.org/show_bug.cgi?id=603590

gobject/gsignal.c

index d69b880..9004ee8 100644 (file)
@@ -1980,13 +1980,11 @@ g_signal_chain_from_overridden_handler (gpointer instance,
           GType ptype = node->param_types[i] & ~G_SIGNAL_TYPE_STATIC_SCOPE;
           gboolean static_scope = node->param_types[i] & G_SIGNAL_TYPE_STATIC_SCOPE;
 
-          param_values[i].g_type = 0;
           SIGNAL_UNLOCK ();
-          g_value_init (param_values + i, ptype);
-          G_VALUE_COLLECT (param_values + i,
-                           var_args,
-                           static_scope ? G_VALUE_NOCOPY_CONTENTS : 0,
-                           &error);
+          G_VALUE_COLLECT_INIT (param_values + i, ptype,
+                               var_args,
+                               static_scope ? G_VALUE_NOCOPY_CONTENTS : 0,
+                               &error);
           if (error)
             {
               g_warning ("%s: %s", G_STRLOC, error);
@@ -2949,13 +2947,11 @@ g_signal_emit_valist (gpointer instance,
       GType ptype = node->param_types[i] & ~G_SIGNAL_TYPE_STATIC_SCOPE;
       gboolean static_scope = node->param_types[i] & G_SIGNAL_TYPE_STATIC_SCOPE;
 
-      param_values[i].g_type = 0;
       SIGNAL_UNLOCK ();
-      g_value_init (param_values + i, ptype);
-      G_VALUE_COLLECT (param_values + i,
-                      var_args,
-                      static_scope ? G_VALUE_NOCOPY_CONTENTS : 0,
-                      &error);
+      G_VALUE_COLLECT_INIT (param_values + i, ptype,
+                           var_args,
+                           static_scope ? G_VALUE_NOCOPY_CONTENTS : 0,
+                           &error);
       if (error)
        {
          g_warning ("%s: %s", G_STRLOC, error);