Closed Bug 944149 Opened 11 years ago Closed 11 years ago

Optimize nsContentUtils::PositionIsBefore

Categories

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

x86_64
Linux
defect
Not set
normal

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?
https://hg.mozilla.org/mozilla-central/rev/bf413fe5f44e
Status: NEW → RESOLVED
Closed: 11 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.

Attachment

General

Created:
Updated:
Size: