Closed Bug 1479398 Opened 6 years ago Closed 6 years ago

The is_root() fast-path could be faster.

Categories

(Core :: CSS Parsing and Computation, enhancement)

enhancement
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla63
Tracking Status
firefox63 --- fixed

People

(Reporter: emilio, Assigned: emilio)

References

Details

Attachments

(1 file)

I thought that bug 1478985 wouldn't make a difference in common cases since we already need to poke at the element and such for looking up in the selector maps.

But is_root right now pokes at the parent in the common case. That can be faster.
We can discard the common case of an element having another element or document
fragment parent, which is the common case.

Then we can discard detached subtrees looking at is_in_document().

The only case where we have a non-content parent is the document case:

  https://searchfox.org/mozilla-central/rev/033d45ca70ff32acf04286244644d19308c359d5/dom/base/Element.cpp#1683
Pushed by emilio@crisal.io:
https://hg.mozilla.org/integration/mozilla-inbound/rev/89fcb03e210c
Micro-optimize is_root to avoid poking at the parent in the common case. r=xidorn
Backout by emilio@crisal.io:
https://hg.mozilla.org/integration/mozilla-inbound/rev/951af7075518
Back out changeset 89fcb03e210c because it's not reviewed yet. r=backout
Comment on attachment 8995933 [details]
Bug 1479398: Micro-optimize is_root to avoid poking at the parent in the common case. r=xidorn

Xidorn Quan [:xidorn] UTC+10 has approved the revision.

https://phabricator.services.mozilla.com/D2505
Attachment #8995933 - Flags: review+
Pushed by emilio@crisal.io:
https://hg.mozilla.org/integration/mozilla-inbound/rev/7197c675f225
Micro-optimize is_root to avoid poking at the parent in the common case. r=xidorn
https://hg.mozilla.org/mozilla-central/rev/7197c675f225
Status: NEW → RESOLVED
Closed: 6 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla63
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: