layout: Profile the CSS cascade as well as selector matching.

It's slow.
This commit is contained in:
Patrick Walton 2014-01-25 18:13:59 -08:00
parent edda06115a
commit 55ccfae1e8
2 changed files with 7 additions and 3 deletions

View file

@ -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);
});
}

View file

@ -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)