diff options
author | Matthias Clasen <mclasen@redhat.com> | 2020-01-24 22:52:38 -0500 |
---|---|---|
committer | Matthias Clasen <mclasen@redhat.com> | 2020-01-25 01:20:17 -0500 |
commit | 4ab0e7956eb90e9d99ba686117fb1896cfc4f31a (patch) | |
tree | e202d021e0ab270ad528e9610273d9a4926e53e8 /gtk/gtkcssstylepropertyimpl.c | |
parent | 1eec7362b91fe083599890e753e4398673b78994 (diff) | |
download | gtk+-matthiasc/css-value-inner-loop.tar.gz |
css: Reshuffle the inner loop of value computationmatthiasc/css-value-inner-loop
The loop over all properties in gtk_css_static_style_compute_values
is the inner loop of the css value computation, we hit it thousands
of times per frame. Rearrange things to make this faster, by avoiding
function calls, pulling the section handling out of the separate loop,
and handling the border-width special case in a neater way.
Before: 50 runs, min 12.45, max 20.419, avg 15.9414
After: 50 runs, min 12.622, max 21.195, avg 15.0449
Diffstat (limited to 'gtk/gtkcssstylepropertyimpl.c')
-rw-r--r-- | gtk/gtkcssstylepropertyimpl.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/gtk/gtkcssstylepropertyimpl.c b/gtk/gtkcssstylepropertyimpl.c index ce076944d5..2b346d4a26 100644 --- a/gtk/gtkcssstylepropertyimpl.c +++ b/gtk/gtkcssstylepropertyimpl.c @@ -66,6 +66,8 @@ typedef enum { GTK_STYLE_PROPERTY_ANIMATED = (1 << 1), } GtkStylePropertyFlags; +gboolean inherit_properties[ GTK_CSS_PROPERTY_N_PROPERTIES]; + static void gtk_css_style_property_register (const char * name, guint expected_id, @@ -96,6 +98,8 @@ gtk_css_style_property_register (const char * name, _gtk_css_value_unref (initial_value); + inherit_properties[expected_id] = (flags & GTK_STYLE_PROPERTY_INHERIT) ? TRUE : FALSE; + g_assert (_gtk_css_style_property_get_id (node) == expected_id); } @@ -924,6 +928,7 @@ icon_theme_value_parse (GtkCssStyleProperty *property, G_STATIC_ASSERT (GTK_CSS_PROPERTY_COLOR == 0); G_STATIC_ASSERT (GTK_CSS_PROPERTY_DPI < GTK_CSS_PROPERTY_FONT_SIZE); + void _gtk_css_style_property_init_properties (void) { @@ -1720,4 +1725,5 @@ _gtk_css_style_property_init_properties (void) parse_font_variation_settings, NULL, gtk_css_font_variations_value_new_default ()); + } |