Closed Bug 304759 Opened 19 years ago Closed 19 years ago

Avoid link map maintenance when tearing down document

Categories

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

defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: roc, Assigned: roc)

References

Details

(Keywords: fixed1.8, perf)

Attachments

(1 file)

bz's profile shows the fix for bug 78510 added significant cost when tearing
down documents. In particular, for every link, UnbindFromTree calls ForgetLink
which constructs a new URI for the link, which is expensive.

We can fix this by destroying the link map before calling UnbindFromTree when we
know that all the document's elements are being unbound. Then in ForgetLink we
just check to see if the map is empty before we do anything.
Keywords: perf
Flags: blocking1.8b4+
Attached patch fixSplinter Review
This fix appears quite straightforward.
Attachment #192872 - Flags: superreview?(bzbarsky)
Attachment #192872 - Flags: review?(bzbarsky)
Comment on attachment 192872 [details] [diff] [review]
fix

Excellent.  r+sr=bzbarsky if you also fix nsDocument::ReplaceChild (see the
code at
http://lxr.mozilla.org/seamonkey/source/content/base/src/nsDocument.cpp#3640
which removes and unbinds the node and then possibly resets mRootContent; in
the case when it would do this last, you want to clear the link map before
removing and unbinding).
Attachment #192872 - Flags: superreview?(bzbarsky)
Attachment #192872 - Flags: superreview+
Attachment #192872 - Flags: review?(bzbarsky)
Attachment #192872 - Flags: review+
checked into trunk. Let's look for branch approval once we see the trunk Tp impact.
Status: NEW → RESOLVED
Closed: 19 years ago
Resolution: --- → FIXED
Comment on attachment 192872 [details] [diff] [review]
fix

This seems to have reduced the impact of 78510 to almost zero. definitely
should go on the branch.
Attachment #192872 - Flags: approval1.8b4?
Attachment #192872 - Flags: approval1.8b4? → approval1.8b4+
WOOT!
checked in on branch
Keywords: fixed1.8
bz's review comment didn't seem to make it into the version checked in to the
branch.
oops, I'll fix that. Thanks for picking it up!
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: