Closed Bug 600257 Opened 9 years ago Closed 9 years ago

Only flush when really needed in content lists

Categories

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

defect

Tracking

()

RESOLVED FIXED
mozilla5

People

(Reporter: bzbarsky, Assigned: bzbarsky)

References

(Blocks 1 open bug)

Details

(Keywords: perf)

Attachments

(2 files)

Attached file Microbenchmark
Since the HTML5 parser doesn't leave the DOM in an inconsistent state, we no longer need content flushes in HTML documents.  We still need them in XML for now, sadly, but we can optimize away the HTML ones pretty well.

On the attached microbenchmark, I see these numbers (for a bunch of .length gets before/after onload):

Opera: 1800 1650

Chrome 7 dev: 642 523

Safari 5: 240 241

Trunk (Mac 64-bit): 650 270

Trunk with upcoming patch: 229 239
Attachment #479094 - Flags: review?(peterv)
What happens if the owner of nsChildContentList is moved to another document
(from HTML to XML document), or just added to document (so that GetCurrentDoc returns non-null)?
This only matters for cases when the element in question is on the parser's open-tag stack and actively being parsed into.  The behavior of moving such elements between documents is not interoperable across web browsers, so I really doubt sites do that.
Whiteboard: [need review]
Attachment #479094 - Flags: review?(peterv) → review+
Whiteboard: [need review] → [need approval]
Comment on attachment 479094 [details] [diff] [review]
.  Only flush in content lists if we're in an XML document.

Requesting approval for this simple safe perf win.
Attachment #479094 - Flags: approval2.0?
Whiteboard: [need approval] → [need gk2 ship]
Attachment #479094 - Flags: approval2.0? → approval2.0-
http://hg.mozilla.org/projects/cedar/rev/77483e45592e
Whiteboard: [need gk2 ship] → [need gk2 ship][fixed-in-cedar]
Whiteboard: [need gk2 ship][fixed-in-cedar] → [fixed-in-cedar]
http://hg.mozilla.org/mozilla-central/rev/77483e45592e
Status: NEW → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
Whiteboard: [fixed-in-cedar]
Target Milestone: --- → mozilla2.2
Flags: in-testsuite-
Component: DOM → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.