diff options
author | Matthias Clasen <mclasen@redhat.com> | 2020-01-19 11:34:53 -0500 |
---|---|---|
committer | Matthias Clasen <mclasen@redhat.com> | 2020-01-19 19:00:00 -0500 |
commit | 675214574cfc5e49cb25988c126836b2487e56f9 (patch) | |
tree | ee1430258bad21f515cf03d58d600b6ad454522e /gtk/gtkcssprovider.c | |
parent | 31b15bf5e0baa4ae98a92bf82842cac033d5bb03 (diff) | |
download | gtk+-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.c | 2 |
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; }; |