Closed Bug 90756 Opened 23 years ago Closed 22 years ago

DemoteForm takes 1.7% of ibench time

Categories

(Core :: DOM: HTML Parser, defect)

x86
Linux
defect
Not set
normal

Tracking

()

VERIFIED FIXED
mozilla1.0.1

People

(Reporter: dbaron, Assigned: john)

References

Details

(Keywords: perf, Whiteboard: [FIX])

Attachments

(5 files, 3 obsolete files)

I just took a realtime jprof profile of a complete run of the ibench HTML load
speed test, and 1.7% of the time was within SinkContext::DemoteContainer.  (It
was in 512 stacks out of 30,300 non-polling stacks in the profile.)

Of those 512 stacks:
 * 334 are calling nsGenericHTMLContainerElement::AppendChild
 * 110 are calling nsGenericHTMLContainerElement::RemoveChild
 * 51 are calling SinkContext::FlushTags

I was wondering why we actually need to move content around.  Would it be
possible to come up with a solution where all the form controls are all parented
to the correct parent (i.e., none, or a different form other than one
incorrectly terminated within a table) and we didn't have to rearrange the
content model as we were going?
Status: NEW → ASSIGNED
Target Milestone: --- → mozilla1.0
A correct removeChild() if a form's child should make all controls in that
child's subtree drop pointers to the form.  The current form control handling in
DemoteContainer would break in those circumstances.  So this is blocking bug 98487.
Blocks: 98487
QA Contact: bsharma → moied
Bugs targeted at mozilla1.0 without the mozilla1.0 keyword moved to mozilla1.0.1 
(you can query for this string to delete spam or retrieve the list of bugs I've 
moved)
Target Milestone: mozilla1.0 → mozilla1.0.1
It seems like this should be possible, but I have heard it has been tried before.

Note that DemoteContainer() is now DemoteForm(), since it only works on forms
anyway.
Summary: DemoteContainer takes 1.7% of ibench time → DemoteForm takes 1.7% of ibench time
Blocks: 124875
Attached patch Patch to remove DemoteForm (obsolete) — Splinter Review
This patch removes DemoteForm entirely, per conversations with Vidur and
Harish.  In fact I modified it a little from what I discussed with you two,
specifically instead of adding that "close form immediately after X tag"
feature, I just let the content sink handle automatic closing of the form tag.

Here is how forms work with this patch:
1. When <form> is found, mCurrentForm is set and the container is opened.
2. When </form> is found, mCurrentForm is nulled and IF we are balanced (if we
would not be closing any other tags inadvertently), we close the container. 
Otherwise, we wait for the sink to close the form container automatically,
which it will do as soon as it finds the close tag for the form's parent (same
as any other unbalanced container).

Big Monkey Testcase and screenshots shortly.
Attached file Testcase
This testcase shows the three possible cases: one balanced form and two
unbalanced forms.
Attached image Screenshot WITH fix
Screenshot on build with fix applied
Attached image Screenshot WITHOUT fix
Screenshot WITHOUT fix
Reassigning to me.
Assignee: harishd → jkeiser
Status: ASSIGNED → NEW
Whiteboard: [FIX]
Status: NEW → ASSIGNED
Attached patch Patch v1.0.1 (obsolete) — Splinter Review
Going through smoketests I noticed a crash with iframes and realized I had
exposed issues with iframe that I had not addressed in other iframe bugs (the
big one being that you should *never* destroy a the frameloader while the frame
is still around).  Iframe issues fixed.

TESTING ON THIS PATCH:
- smoketest - went to every smoketest site and did searches on each one
- testcases on this bug
- bugzilla.mozilla.org (all updates to this bug done with the patched build)
- tinderbox (including verifying that the iframe popup works)
- bug 98487
- bug 52334

I think we are clear.

Harish?  Vidur?  Reviews? :)
Attachment #82129 - Attachment is obsolete: true
Blocks: 98506
Comment on attachment 82178 [details] [diff] [review]
Patch v1.0.1

sr=vidur on all but the iframe/frameloader stuff. jkeiser says he'll get jst to
look at it.
Comment on attachment 82178 [details] [diff] [review]
Patch v1.0.1

sr=vidur on all but the iframe/frameloader stuff. jkeiser says he'll get jst to
look at it.
Attachment #82178 - Flags: superreview+
Comment on attachment 82178 [details] [diff] [review]
Patch v1.0.1

r=harishd
Attachment #82178 - Flags: review+
Attached patch Patch v1.0.2 (obsolete) — Splinter Review
Patch to fix an issue JST brought up, that the change of
nsGenericHTML(Container|Leaf)FormElement::mForm to an nsCOMPtr creates a
circular dependency.  This should not create a leak, as it turns out, because
we have code in to break the dependency anyway, but a circular dependency is
still a bad idea.

This is UNTESTED but compiles.	This is mainly for JST to verify and hopefully
sr= alongside vidur; I will test later on Bugzilla, my form tester and on these
testcases to verify that everything still works.  (It will. :)
Attachment #82178 - Attachment is obsolete: true
OK, so one should use ->Release() instead of NS_RELEASE if one does not wish
the pointer to be cleared :)  This has been tested specifically against
Bugzilla, the testcase in this bug, and a form at my website.  Uploading with
patched build of course.
Attachment #82760 - Attachment is obsolete: true
Comment on attachment 82820 [details] [diff] [review]
Patch v1.0.3 (Brown Bag Release)

sr=jst, but please loose the changes in neGenericHTMLElement.h, you don't need
those any more.
Attachment #82820 - Flags: superreview+
Comment on attachment 82820 [details] [diff] [review]
Patch v1.0.3 (Brown Bag Release)

Carrying r= (small changes, I let Harish know what changes before the first r=)
Attachment #82820 - Flags: review+
Fixed on trunk, and gave us 10ms pageload time out of 1200 there.  I have not
run iBench, either, but it is literally impossible for DemoteForm to take 1.7%
of the time on it because DemoteForm no longer exists :)
Status: ASSIGNED → RESOLVED
Closed: 22 years ago
Resolution: --- → FIXED
Nominating in case adt wants the 10ms pageload improvement (between 0.5% and 1%).
Keywords: adt1.0.0, nsbeta1
Just wanted to notate that the removal of DemoteForm() fixes a problem seen with
some sites like:

  http://www.google.com/advanced_group_search?hl=en

where a textwidget is programatically given focus, via JS, during the document
load, and then the caret disappears. (First reported in bug 51897 comment 11)

What was happening was that DemoteForm() was triggering frame destruction and
reconstruction, after a textwidget frame was given focus. After the frames were
recreated the textwidget was totally unaware that it had focus, since no focus
event was dispatched during it's lifetime, so it didn't know it should display
it's caret.
Keywords: nsbeta1nsbeta1+
Blocks: 143917
The patch in bug 143917 must be checked in if the patch in this bug is checked in.
adding adt1.0.0-.  Let's get this in the next release.
Keywords: adt1.0.0adt1.0.0-
Verified fixed with trunk build ID 20020529 using winxp
Status: RESOLVED → VERIFIED
*** Bug 64450 has been marked as a duplicate of this bug. ***
Acting on Duplicate resolution from bug 64450 comment 29:

*Moving 'Blocks: bug 64451' from bug 64450 to bug 90756.
 (Take further action as needed.)
Blocks: focusblink
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: