From cea0f412145c239a7583c10554c2d88964e94fd7 Mon Sep 17 00:00:00 2001 From: Michael Drake Date: Sun, 1 Dec 2013 19:02:37 +0000 Subject: Significantly optimise CSS selection performance. Now we pass a node bloom filter to css_get_style. That node bloom filter is filled with the node's ancestor element, class, and id names. Internally, libcss also generates a bloom filter for each selector chain. If the selector chain's bloom filter is not a subset of the node bloom filter, we know that the selector chain's rule does not apply to the node. This avoids the slow selector chain matching process. Other smaller optimisations to move the ruling out of selector chains for inapplicable media types and other reasons to before we start comparing rules from different sources to find the next rule. All this is now done in hash.c so select.c never sees the trivially ruled out rules. --- include/libcss/libcss.h | 1 + include/libcss/select.h | 2 ++ 2 files changed, 3 insertions(+) (limited to 'include') diff --git a/include/libcss/libcss.h b/include/libcss/libcss.h index 89e83b5..bde2707 100644 --- a/include/libcss/libcss.h +++ b/include/libcss/libcss.h @@ -15,6 +15,7 @@ extern "C" #include +#include #include #include #include diff --git a/include/libcss/select.h b/include/libcss/select.h index 4a95752..9ab2550 100644 --- a/include/libcss/select.h +++ b/include/libcss/select.h @@ -13,6 +13,7 @@ extern "C" { #endif +#include #include #include #include @@ -162,6 +163,7 @@ css_error css_select_ctx_get_sheet(css_select_ctx *ctx, uint32_t index, const css_stylesheet **sheet); css_error css_select_style(css_select_ctx *ctx, void *node, + const css_bloom bloom[CSS_BLOOM_SIZE], uint64_t media, const css_stylesheet *inline_style, css_select_handler *handler, void *pw, css_select_results **result); -- cgit v1.2.1