[glib/prop-set-speedups: 2/2] Small optimization for g_object_setv
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib/prop-set-speedups: 2/2] Small optimization for g_object_setv
- Date: Mon, 20 Sep 2021 12:22:55 +0000 (UTC)
commit 497986cdc1fe9e7f719ca8982b2f7c7942f081c6
Author: Matthias Clasen <mclasen redhat com>
Date: Mon Sep 20 08:20:04 2021 -0400
Small optimization for g_object_setv
No need to call memset in the loop, we can just
initialize all the values in one go.
GtkBuilder is now using g_object_setv, so this
may improve application start times a bit.
gobject/gobject.c | 9 +++------
1 file changed, 3 insertions(+), 6 deletions(-)
---
diff --git a/gobject/gobject.c b/gobject/gobject.c
index 3767058c4..879ed848b 100644
--- a/gobject/gobject.c
+++ b/gobject/gobject.c
@@ -2523,17 +2523,14 @@ g_object_getv (GObject *object,
g_object_ref (object);
+ memset (values, 0, n_properties * sizeof (GValue));
+
obj_type = G_OBJECT_TYPE (object);
for (i = 0; i < n_properties; i++)
{
- pspec = g_param_spec_pool_lookup (pspec_pool,
- names[i],
- obj_type,
- TRUE);
+ pspec = g_param_spec_pool_lookup (pspec_pool, names[i], obj_type, TRUE);
if (!g_object_get_is_valid_property (object, pspec, names[i]))
break;
-
- memset (&values[i], 0, sizeof (GValue));
g_value_init (&values[i], pspec->value_type);
object_get_property (object, pspec, &values[i]);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]