diff options
author | Alexander Larsson <alexl@redhat.com> | 2017-01-11 08:51:04 +0100 |
---|---|---|
committer | Alexander Larsson <alexl@redhat.com> | 2017-01-11 09:20:30 +0100 |
commit | 882290b479c02f2bc6d1d3d85b09dc3cc66dc9b9 (patch) | |
tree | 07a5cad4e624cc7e31f909e53006f9732cc92969 /gtk | |
parent | 249a0b1f22a9b7cb882c2d9ce18994a028025072 (diff) | |
download | gtk+-882290b479c02f2bc6d1d3d85b09dc3cc66dc9b9.tar.gz |
Skip dynamic type check in css value getters
This gets called a lot during snapshotting, and this change
alone brings down snapshot time by almost 10% in a syntethic
snapshot test.
Diffstat (limited to 'gtk')
-rw-r--r-- | gtk/gtkcssanimatedstyle.c | 5 | ||||
-rw-r--r-- | gtk/gtkcssstaticstyle.c | 3 | ||||
-rw-r--r-- | gtk/gtkcssstyle.c | 2 |
3 files changed, 4 insertions, 6 deletions
diff --git a/gtk/gtkcssanimatedstyle.c b/gtk/gtkcssanimatedstyle.c index 1e89088a6b..aadaf97173 100644 --- a/gtk/gtkcssanimatedstyle.c +++ b/gtk/gtkcssanimatedstyle.c @@ -44,7 +44,8 @@ static GtkCssValue * gtk_css_animated_style_get_value (GtkCssStyle *style, guint id) { - GtkCssAnimatedStyle *animated = GTK_CSS_ANIMATED_STYLE (style); + /* This is called a lot, so we avoid a dynamic type check here */ + GtkCssAnimatedStyle *animated = (GtkCssAnimatedStyle *) style; if (animated->animated_values && id < animated->animated_values->len && @@ -147,8 +148,6 @@ GtkCssValue * gtk_css_animated_style_get_intrinsic_value (GtkCssAnimatedStyle *style, guint id) { - gtk_internal_return_val_if_fail (GTK_IS_CSS_ANIMATED_STYLE (style), NULL); - return gtk_css_style_get_value (style->style, id); } diff --git a/gtk/gtkcssstaticstyle.c b/gtk/gtkcssstaticstyle.c index 217bb06265..f8ce97003d 100644 --- a/gtk/gtkcssstaticstyle.c +++ b/gtk/gtkcssstaticstyle.c @@ -44,7 +44,8 @@ static GtkCssValue * gtk_css_static_style_get_value (GtkCssStyle *style, guint id) { - GtkCssStaticStyle *sstyle = GTK_CSS_STATIC_STYLE (style); + /* This is called a lot, so we avoid a dynamic type check here */ + GtkCssStaticStyle *sstyle = (GtkCssStaticStyle *) style; return sstyle->values[id]; } diff --git a/gtk/gtkcssstyle.c b/gtk/gtkcssstyle.c index 1d607d8367..250371f7fe 100644 --- a/gtk/gtkcssstyle.c +++ b/gtk/gtkcssstyle.c @@ -69,8 +69,6 @@ GtkCssValue * gtk_css_style_get_value (GtkCssStyle *style, guint id) { - gtk_internal_return_val_if_fail (GTK_IS_CSS_STYLE (style), NULL); - return GTK_CSS_STYLE_GET_CLASS (style)->get_value (style, id); } |