Phase 8: StyleCache memoization
Add StyleCache struct with hash-keyed LRU-eviction strategy and integrate into StyleSheet via Mutex<StyleCache> so no signature changes are needed on evaluate_vdom_incr. - StyleCache::get_or_compute hashes (type_name, props, epoch) -> ComputedStyle - LRU: full clear on overflow (max 1024) - RefCell avoided in favor of Mutex so StyleSheet remains Sync for parallel matching_rules_batch - Manual Clone impl skips cache (fresh cache on clone) - Call sites in evaluate_vdom_incr switched from ComputedStyle::compute to stylesheet.compute_cached - Cache cleared in build_index after epoch increment (stale entries)
This commit is contained in:
@@ -469,7 +469,7 @@ impl Interpreter {
|
||||
}
|
||||
|
||||
let matched_sheets = Self::collect_matching_styles(&vcomp, stylesheet, &[], &structural, ancestors, &sibling_infos[0..i]);
|
||||
vcomp.computed_style = ComputedStyle::compute(&vcomp.properties, &matched_sheets);
|
||||
vcomp.computed_style = stylesheet.compute_cached(vcomp.type_name, &vcomp.properties, &matched_sheets);
|
||||
|
||||
let child_ancestors = Self::build_ancestor_chain(ancestors, &vcomp);
|
||||
let comp_child_refs: Vec<&Element<'a>> = comp.children.iter().collect();
|
||||
@@ -502,7 +502,7 @@ impl Interpreter {
|
||||
}
|
||||
|
||||
let matched_sheets = Self::collect_matching_styles(&vnode, stylesheet, &[], &structural, ancestors, &sibling_infos[0..i]);
|
||||
vnode.computed_style = ComputedStyle::compute(&vnode.properties, &matched_sheets);
|
||||
vnode.computed_style = stylesheet.compute_cached(vnode.type_name, &vnode.properties, &matched_sheets);
|
||||
|
||||
let child_ancestors = Self::build_ancestor_chain(ancestors, &vnode);
|
||||
let child_refs: Vec<&Element<'a>> = el.children.iter().collect();
|
||||
|
||||
Reference in New Issue
Block a user