[gtk/wip/baedert/for-master: 9/9] widget: Speed up verify_invariants()
- From: Timm Bäder <baedert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/wip/baedert/for-master: 9/9] widget: Speed up verify_invariants()
- Date: Thu, 6 Feb 2020 15:54:17 +0000 (UTC)
commit 67300d7050e01e15d908a6985f6544465fc62d9c
Author: Timm Bäder <mail baedert org>
Date: Thu Feb 6 08:17:51 2020 +0100
widget: Speed up verify_invariants()
Hide the expensive GTK_IS_ROOT() checks behind the cheaper realized,
mapped, etc. checks. This way we only check for the widget being a root
if the invariant does not hold.
This gets pop_verify_invariants() from 16% to 6% when running the
scrolling benchmark in the widget-factory.
gtk/gtkwidget.c | 35 ++++++++++++++---------------------
1 file changed, 14 insertions(+), 21 deletions(-)
---
diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c
index b84d8f4da2..71fe4c4e8f 100644
--- a/gtk/gtkwidget.c
+++ b/gtk/gtkwidget.c
@@ -6336,12 +6336,9 @@ gtk_widget_verify_invariants (GtkWidget *widget)
g_warning ("%s %p is mapped but not visible",
gtk_widget_get_name (widget), widget);
- if (!GTK_IS_ROOT (widget))
- {
- if (!priv->child_visible)
- g_warning ("%s %p is mapped but not child_visible",
- gtk_widget_get_name (widget), widget);
- }
+ if (!priv->child_visible && !GTK_IS_ROOT (widget))
+ g_warning ("%s %p is mapped but not child_visible",
+ gtk_widget_get_name (widget), widget);
}
else
{
@@ -6384,14 +6381,12 @@ gtk_widget_verify_invariants (GtkWidget *widget)
G_OBJECT_TYPE_NAME (widget), widget);
#endif
}
- else if (!GTK_IS_ROOT (widget))
+ else if (priv->realized && !GTK_IS_ROOT (widget))
{
/* No parent or parent not realized on non-toplevel implies... */
-
- if (priv->realized)
- g_warning ("%s %p is not realized but child %s %p is realized",
- parent ? gtk_widget_get_name (parent) : "no parent", parent,
- gtk_widget_get_name (widget), widget);
+ g_warning ("%s %p is not realized but child %s %p is realized",
+ parent ? gtk_widget_get_name (parent) : "no parent", parent,
+ gtk_widget_get_name (widget), widget);
}
if (parent &&
@@ -6406,17 +6401,15 @@ gtk_widget_verify_invariants (GtkWidget *widget)
gtk_widget_get_name (parent), parent,
gtk_widget_get_name (widget), widget);
}
- else if (!GTK_IS_ROOT (widget))
+ else if (priv->mapped && !GTK_IS_ROOT (widget))
{
/* No parent or parent not mapped on non-toplevel implies... */
-
- if (priv->mapped)
- g_warning ("%s %p is mapped but visible=%d child_visible=%d parent %s %p mapped=%d",
- gtk_widget_get_name (widget), widget,
- priv->visible,
- priv->child_visible,
- parent ? gtk_widget_get_name (parent) : "no parent", parent,
- parent ? parent->priv->mapped : FALSE);
+ g_warning ("%s %p is mapped but visible=%d child_visible=%d parent %s %p mapped=%d",
+ gtk_widget_get_name (widget), widget,
+ priv->visible,
+ priv->child_visible,
+ parent ? gtk_widget_get_name (parent) : "no parent", parent,
+ parent ? parent->priv->mapped : FALSE);
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]