Closed Bug 599955 Opened 14 years ago Closed 14 years ago

Optimize DocumentEncoder

Categories

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

x86
All
defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: smaug, Assigned: smaug)

References

(Blocks 1 open bug)

Details

Attachments

(4 files)

Attached file a testcase
There are still several small things to optimize in DocumentEncoder. The testcase is a kind of worst-case for gecko. It shows problems in the DocumentEncoder recursion, SerializeNodeStart and attribute entity conversion (which happens in serializer, and which this bug is not about).
Attached patch wipSplinter Review
Something like this should help a bit.
You probably could replace some static_casts with AsElement in the code you're moving.
Attachment #478874 - Flags: review?(bzbarsky)
So the patch adds a special case for the cases like innerHTML, when it is enough to serialize contents of a node in a fast way.
Comment on attachment 478874 [details] [diff] [review] a bit simpler patch >+++ b/content/base/src/nsDocumentEncoder.cpp >@@ -359,29 +362,29 @@ nsDocumentEncoder::SerializeNodeStart(ns >+ if (node->IsElement()) { >+ nsIContent* originalElement = Make that an Element*? >+ aOriginalNode && aOriginalNode->IsElement() ? >+ aOriginalNode->AsElement() : nsnull; Maybe I should have added a static AsElement() instead, that cast null to null. :( >+ mSerializer->AppendElementStart(static_cast<nsIContent*>(node), >+ originalElement, aStr); And here you can pass node->AsElement() for the first arg, and then it will all Just Work when we change AppendElementStart to take Element. ;) With those nits, r=me. This looks great!
Attachment #478874 - Flags: review?(bzbarsky) → review+
Depends on: 601590
Blocks: 601590
No longer depends on: 601590
Attached patch patchSplinter Review
This is part of getinnerhtml optimizations and would be great to get this to ff4.
Attachment #482536 - Flags: approval2.0?
Attachment #482536 - Flags: approval2.0? → approval2.0+
Status: NEW → RESOLVED
Closed: 14 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: