Closed Bug 1385521 Opened 2 years ago Closed 2 years ago

nsRange::GetCommonAncestor() is expensive for the obvious case

Categories

(Core :: DOM: Core & HTML, enhancement)

enhancement
Not set

Tracking

()

RESOLVED FIXED
mozilla56
Tracking Status
firefox56 --- fixed

People

(Reporter: ehsan, Assigned: ehsan)

References

(Blocks 1 open bug)

Details

Attachments

(1 file)

For text controls, the start and end of the container is the same often times, but because the nsContentUtils API doesn't get inlines, nsRange::GetCommonAncestor() shows up in profiles of bug 1346723.

GetCommonAncestorInternal() is a template, so we already have two copies of this check: https://searchfox.org/mozilla-central/rev/09c065976fd4f18d4ad764d7cb4bbc684bf56714/dom/base/nsContentUtils.cpp#2709.  So we may as well inline them in the header to get them to the caller side instead so that we make the common case for these situations faster.
Attachment #8891597 - Flags: review?(amarchesini) → review+
Pushed by eakhgari@mozilla.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/76abbe45dd0a
Inline the check for common argument in the callers of GetCommonAncestorInternal(); r=baku
https://hg.mozilla.org/mozilla-central/rev/76abbe45dd0a
Status: NEW → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla56
Assignee: nobody → ehsan
Component: DOM → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.