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.
This commit is contained in:
Alexander Larsson 2017-01-11 08:51:04 +01:00
parent 249a0b1f22
commit 882290b479
3 changed files with 4 additions and 6 deletions

View File

@ -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);
}

View File

@ -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];
}

View File

@ -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);
}