Closed
Bug 1356148
Opened 8 years ago
Closed 8 years ago
stylo: Coalesce duplicate slow selector flags
Categories
(Core :: CSS Parsing and Computation, defect, P1)
Core
CSS Parsing and Computation
Tracking
()
RESOLVED
FIXED
People
(Reporter: bholley, Assigned: bholley)
References
(Blocks 1 open bug)
Details
Attachments
(2 files)
3.93 KB,
patch
|
emilio
:
review+
|
Details | Diff | Splinter Review |
23.51 KB,
patch
|
emilio
:
review+
|
Details | Diff | Splinter Review |
The current setup blows up with the testcase at [1] modified to have the selector of "span + div".
[1] https://hg.mozilla.org/integration/autoland/file/6386d8f32e1d/testing/talos/talos/tests/perf-reftest/bloom-basic.html
Assignee | ||
Comment 1•8 years ago
|
||
Assignee | ||
Comment 2•8 years ago
|
||
Assignee | ||
Comment 3•8 years ago
|
||
We also reverse the order, so that we don't need iter.rev().
Attachment #8857876 -
Flags: review?(emilio+bugs)
Assignee | ||
Comment 4•8 years ago
|
||
This reduces the flag setting overhead on a pessimal from over a second to ~20ms.
Attachment #8857877 -
Flags: review?(emilio+bugs)
Comment 5•8 years ago
|
||
Comment on attachment 8857876 [details] [diff] [review]
Part 1 - Optimize LRUCache by using a VecDeque. v1
Review of attachment 8857876 [details] [diff] [review]:
-----------------------------------------------------------------
::: servo/components/style/cache.rs
@@ +37,5 @@
> self.entries.len()
> }
>
> #[inline]
> /// Touch a given position, and put it in the last item on the list.
Update the comment above this, please :)
::: servo/components/style/context.rs
@@ +8,5 @@
> use animation::{Animation, PropertyAnimation};
> use app_units::Au;
> use bit_vec::BitVec;
> use bloom::StyleBloom;
> +use cache::LRUCache;
This seems out of place, right?
Attachment #8857876 -
Flags: review?(emilio+bugs) → review+
Comment 6•8 years ago
|
||
Comment on attachment 8857877 [details] [diff] [review]
Part 2 - Store slow selector flags in a hashmap. v1
Review of attachment 8857877 [details] [diff] [review]:
-----------------------------------------------------------------
The commit message needs updating: "on a pessimal"? I guess you mean "pessimal situation" or something like that?
Anyway, with that and the following nits addressed. r=me
::: servo/components/style/context.rs
@@ +308,5 @@
> + *f |= flags;
> +
> + // Insert into the cache. We don't worry about duplicate entries,
> + // which lets us avoid reshuffling.
> + self.cache.insert((unsafe { SendElement::new(element)}, *f))
nit: Space between the paren and the brace.
@@ +318,5 @@
> + for (el, flags) in self.map.drain() {
> + unsafe { el.set_selector_flags(flags); }
> + }
> + }
> +}
Add a `Drop` implementation that debug_asserts that the map is empty? Or alternatively, just drain it on `Drop`?
@@ +400,5 @@
> debug_assert!(self.current_element_info.is_none());
> + debug_assert!(thread_state::get() == thread_state::LAYOUT);
> +
> + // Apply any slow selector flags that need to be set on parents.
> + self.selector_flags.apply_flags();
Yeah, presumably, just drain it on drop of the SelectorFlagsMap itself.
::: servo/components/style/gecko/wrapper.rs
@@ +701,5 @@
> self.0 as *const _ == other.0 as *const _
> }
> }
>
> +impl<'le> Eq for GeckoElement<'le> {}
Presumably you also need to do the same in the Servo side, but assuming it's the same, that's fine.
Attachment #8857877 -
Flags: review?(emilio+bugs) → review+
Assignee | ||
Comment 7•8 years ago
|
||
(In reply to Emilio Cobos Álvarez [:emilio] from comment #6)
> Comment on attachment 8857877 [details] [diff] [review]
> Part 2 - Store slow selector flags in a hashmap. v1
>
> Review of attachment 8857877 [details] [diff] [review]:
> -----------------------------------------------------------------
>
> The commit message needs updating: "on a pessimal"? I guess you mean
> "pessimal situation" or something like that?
:-P
> @@ +318,5 @@
> > + for (el, flags) in self.map.drain() {
> > + unsafe { el.set_selector_flags(flags); }
> > + }
> > + }
> > +}
>
> Add a `Drop` implementation that debug_asserts that the map is empty? Or
> alternatively, just drain it on `Drop`?
I think there's value in having this logic in the same place as the SequentialTask dispatch logic. I'll add the debug-only drop.
Assignee | ||
Comment 8•8 years ago
|
||
Assignee | ||
Updated•8 years ago
|
Status: NEW → RESOLVED
Closed: 8 years ago
Resolution: --- → FIXED
You need to log in
before you can comment on or make changes to this bug.
Description
•