summaryrefslogtreecommitdiff
path: root/gtk/gtkcssprovider.c
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2020-01-19 11:34:53 -0500
committerMatthias Clasen <mclasen@redhat.com>2020-01-19 19:00:00 -0500
commit675214574cfc5e49cb25988c126836b2487e56f9 (patch)
treeee1430258bad21f515cf03d58d600b6ad454522e /gtk/gtkcssprovider.c
parent31b15bf5e0baa4ae98a92bf82842cac033d5bb03 (diff)
downloadgtk+-matthiasc/css-matching-2.tar.gz
css: Break the selector tree into manymatthiasc/css-matching-2
Since we can only match one name, doing a hash by matcher name lets us quickly discard most initial selectors, and having much smaller trees. We can apply the same idea for style classes, as well, by looking up a tree for each class. Comparing the number of gtk_css_selector_match() calls while moving the pointer outside the window, I see: Before: 65773 selector matches (12863 positive) After: 32704 selector matches (12278 positive) So this cuts the numer of selectors we need to check roughly in half, at the cost of a handful of hash table lookups.
Diffstat (limited to 'gtk/gtkcssprovider.c')
-rw-r--r--gtk/gtkcssprovider.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/gtk/gtkcssprovider.c b/gtk/gtkcssprovider.c
index 5201e00c0a..9b8e37515f 100644
--- a/gtk/gtkcssprovider.c
+++ b/gtk/gtkcssprovider.c
@@ -118,7 +118,7 @@ struct _GtkCssProviderPrivate
GHashTable *keyframes;
GArray *rulesets;
- GtkCssSelectorTree *tree;
+ GtkCssSelectorTrees *tree;
GResource *resource;
gchar *path;
};