mirror of
https://github.com/servo/servo.git
synced 2025-08-05 05:30:08 +01:00
layout: Profile the CSS cascade as well as selector matching.
It's slow.
This commit is contained in:
parent
edda06115a
commit
55ccfae1e8
2 changed files with 7 additions and 3 deletions
|
@ -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);
|
||||
});
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue