Closed Bug 944149 Opened 6 years ago Closed 6 years ago

Optimize nsContentUtils::PositionIsBefore

Categories

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

x86_64
Linux
defect
Not set

Tracking

()

RESOLVED FIXED
mozilla28
Tracking Status
firefox28 --- fixed

People

(Reporter: smaug, Assigned: smaug)

References

Details

(Whiteboard: [qa-])

Attachments

(3 files)

.
Summary: Don't call nsContentUtils::PositionIsBefore so eagerly in nsContentList::ContentAppended → Optimize nsContentUtils::PositionIsBefore
Attached file test
Comment on attachment 8339650 [details] [diff] [review]
v1

r=me
Attachment #8339650 - Flags: review?(bzbarsky) → review+
Comment on attachment 8339650 [details] [diff] [review]
v1

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

::: content/base/src/nsINode.cpp
@@ +741,5 @@
>    }
> +  if (GetPreviousSibling() == &aOtherNode) {
> +    MOZ_ASSERT(GetParentNode() == aOtherNode.GetParentNode());
> +    return static_cast<uint16_t>(nsIDOMNode::DOCUMENT_POSITION_PRECEDING);
> +  } else if (GetNextSibling() == &aOtherNode) {

Drop the else?
Attached patch without elseSplinter Review
https://hg.mozilla.org/mozilla-central/rev/bf413fe5f44e
Status: NEW → RESOLVED
Closed: 6 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla28
On the test attached here I get
Nightly - 7~10ms
Chrome 31 - 200ms
Firefox Beta - 400ms
IE 11 - 100ms
Flags: in-testsuite?
Whiteboard: [qa-]
Component: DOM → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.