Closed Bug 1364952 Opened 7 years ago Closed 7 years ago

stylo: Use a SmallVec when gathering applicable declarations

Categories

(Core :: CSS Parsing and Computation, enhancement)

enhancement
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: bholley, Assigned: bholley)

References

(Blocks 1 open bug)

Details

Attachments

(2 files)

We've been meaning to fix this for a while, and Julian's profiling raised this as an enormous source of transient allocations.
Attachment #8867769 - Flags: review?(emilio+bugs)
We could considering shrinking this to 8, since julian's testing found that we basically never write to the upper 8 slots on the obama testcase. On the other hand, it may depend a lot on the stylesheet.
Comment on attachment 8867769 [details] [diff] [review]
Use a SmallVec when gathering applicable declarations. v1

Review of attachment 8867769 [details] [diff] [review]:
-----------------------------------------------------------------

::: servo/components/style/matching.rs
@@ +865,5 @@
>      }
>  }
>  
>  fn compute_rule_node<E: TElement>(rule_tree: &RuleTree,
> +                                  applicable_declarations: &mut SmallVec<[ApplicableDeclarationBlock; 16]>,

Could we perhaps make this a typedef?

type ApplicableDeclarationsList = SmallVec<[ApplicableDeclarationBlock; 16]>;

(Perhaps with a comment or something re. the reasoning and the allocator measurements).

Also, perhaps it's worth to change the one in lazy_pseudo_rules, what do you think?
Attachment #8867769 - Flags: review?(emilio+bugs) → review+
Sure, will do on both counts.
Status: NEW → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
Attached file DHAT output, FTR (deleted) —
Is there a way to get hold of the patch that is associated with the NEW->RESOLVED
transition above?  It doesn't seem to be in m-i right now.
Sorry, I realized I never pasted the PR in the bug. Normally I do that: https://github.com/servo/servo/pull/16874

(1): pull autoland
(2): git log
(3): search in your pager for 16874
(4) figure out whether that commit is in central by the same procedure.

Appears not to have merged yet, in this case.
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: