Cache the results of cache entry revalidation and use the bloom filter.

This commit is contained in:
Bobby Holley 2017-04-11 14:23:35 +08:00
parent d51d95d0c7
commit 1663bf6e5d
7 changed files with 100 additions and 49 deletions

View file

@ -680,15 +680,13 @@ fn compute_style<E, D>(_traversal: &D,
use matching::StyleSharingResult::*;
context.thread_local.statistics.elements_styled += 1;
let shared_context = context.shared;
let kind = data.restyle_kind();
// First, try the style sharing cache. If we get a match we can skip the rest
// of the work.
if let MatchAndCascade = kind {
let sharing_result = unsafe {
let cache = &mut context.thread_local.style_sharing_candidate_cache;
element.share_style_if_possible(cache, shared_context, &mut data)
element.share_style_if_possible(context, &mut data)
};
if let StyleWasShared(index) = sharing_result {
context.thread_local.statistics.styles_shared += 1;