Open
Bug 1424022
Opened 8 years ago
Updated 10 months ago
Prefer ids and classes to tag names when collecting ancestor hashes for a selector.
Categories
(Core :: CSS Parsing and Computation, enhancement, P3)
Core
CSS Parsing and Computation
Tracking
()
NEW
People
(Reporter: emilio, Assigned: emilio)
References
(Blocks 1 open bug)
Details
Attachments
(1 file)
Props to Antti in trac.webkit.org/projects/webkit/changeset/225596. Let's see if this helps with stylo-chrome perf.
Comment hidden (mozreview-request) |
Assignee | ||
Comment 2•8 years ago
|
||
(This actually doesn't improve StyleBench that much for us... Let's wait for talos though)
Comment 3•8 years ago
|
||
mozreview-review |
Comment on attachment 8935498 [details]
Bug 1424022: Prefer ids and classes to tags when collecting ancestor hashes.
https://reviewboard.mozilla.org/r/206396/#review212000
Looks reasonable. r=me assuming it does improves talos.
(If it doesn't, maybe we should hold back until we find it really improves anything.)
::: servo/components/selectors/parser.rs:243
(Diff revision 1)
> + for hash in &self.ids {
> + if slots.push(*hash).is_some() {
> + return;
> + }
> + }
> +
> + for hash in &self.classes {
> + if slots.push(*hash).is_some() {
> + return;
> + }
> + }
> +
> + for hash in &self.tags {
> + if slots.push(*hash).is_some() {
> + return;
> + }
> + }
> +
> + for hash in &self.ns {
> + if slots.push(*hash).is_some() {
> + return;
> + }
> + }
Maybe the code can be more compact with
```rust
let mut iter = self.ids.iter()
.chain(self.classes.iter())
.chain(self.tags.iter())
.chain(self.ns.iter());
for hash in iter {
if slots.push(*hash).is_some() {
return;
}
}
```
?
Not sure whether it would have suboptimal codegen, though.
::: servo/components/selectors/parser.rs:295
(Diff revision 1)
> + let mut hash_iter = hashes.iter();
> - for i in 0..4 {
> + for i in 0..4 {
> - hashes[i] = match hash_iter.next() {
> + unpacked_hashes[i] = match hash_iter.next() {
> - Some(x) => x & BLOOM_HASH_MASK,
> + Some(x) => x & BLOOM_HASH_MASK,
> - None => break,
> + None => break,
> - }
> + }
> - }
> + }
Would something like
```rust
for (unpacked_hash, hash) in unpacked_hash.mut_iter().zip(hashes.iter()) {
*unpacked_hash = hash & BLOOM_HASH_MASK;
}
```
be better?
If there is any particular reason that using `0..4` is better, that reason should be put in some comment, I guess.
::: servo/components/selectors/parser.rs:673
(Diff revision 1)
>
> self.0.next()
> }
> }
>
> +
This seems to be an unrelated change.
Attachment #8935498 -
Flags: review?(xidorn+moz) → review+
Updated•8 years ago
|
Priority: -- → P1
Comment 4•8 years ago
|
||
Did we find out if this helped Talos (and whether it helped stylo-chrome specifically)?
Flags: needinfo?(emilio)
Assignee | ||
Comment 5•8 years ago
|
||
Yeah, I don't think it helped, but worth double-checking the talos results:
https://treeherder.mozilla.org/perf.html#/compare?originalProject=try&originalRevision=04a885652b63afbfe44358a4e92e68f8b3519b18&newProject=try&newRevision=fb3f2261dc3bad168a744a993025d3fd2b7a6bc1&framework=1
Flags: needinfo?(emilio)
Updated•8 years ago
|
Priority: P1 → P3
Updated•3 years ago
|
Severity: normal → S3
You need to log in
before you can comment on or make changes to this bug.
Description
•