From 55ccfae1e82e249e168fbd4635909efe5e177e7a Mon Sep 17 00:00:00 2001 From: Patrick Walton Date: Sat, 25 Jan 2014 18:13:59 -0800 Subject: [PATCH] layout: Profile the CSS cascade as well as selector matching. It's slow. --- src/components/main/layout/layout_task.rs | 2 ++ src/components/util/time.rs | 8 +++++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/components/main/layout/layout_task.rs b/src/components/main/layout/layout_task.rs index 6ad34addd76..01bae0b9428 100644 --- a/src/components/main/layout/layout_task.rs +++ b/src/components/main/layout/layout_task.rs @@ -522,6 +522,8 @@ impl LayoutTask { _ => { profile(time::LayoutSelectorMatchCategory, self.profiler_chan.clone(), || { node.match_subtree(self.stylist.clone()); + }); + profile(time::LayoutSelectorCascadeCategory, self.profiler_chan.clone(), || { node.cascade_subtree(None); }); } diff --git a/src/components/util/time.rs b/src/components/util/time.rs index 426cfad705a..905f24afdab 100644 --- a/src/components/util/time.rs +++ b/src/components/util/time.rs @@ -52,6 +52,7 @@ pub enum ProfilerCategory { LayoutPerformCategory, LayoutAuxInitCategory, LayoutSelectorMatchCategory, + LayoutSelectorCascadeCategory, LayoutTreeBuilderCategory, LayoutMainCategory, LayoutParallelWarmupCategory, @@ -79,6 +80,7 @@ impl ProfilerCategory { buckets.insert(LayoutPerformCategory, ~[]); buckets.insert(LayoutAuxInitCategory, ~[]); buckets.insert(LayoutSelectorMatchCategory, ~[]); + buckets.insert(LayoutSelectorCascadeCategory, ~[]); buckets.insert(LayoutTreeBuilderCategory, ~[]); buckets.insert(LayoutMainCategory, ~[]); buckets.insert(LayoutParallelWarmupCategory, ~[]); @@ -96,9 +98,9 @@ impl ProfilerCategory { // and should be printed to indicate this pub fn format(self) -> ~str { let padding = match self { - LayoutAuxInitCategory | LayoutSelectorMatchCategory | LayoutTreeBuilderCategory | - LayoutMainCategory | LayoutDispListBuildCategory | LayoutShapingCategory | - LayoutParallelWarmupCategory => " - ", + LayoutAuxInitCategory | LayoutSelectorMatchCategory | LayoutSelectorCascadeCategory | + LayoutTreeBuilderCategory | LayoutMainCategory | LayoutDispListBuildCategory | + LayoutShapingCategory | LayoutParallelWarmupCategory => " - ", _ => "" }; format!("{:s}{:?}", padding, self)