Closed Bug 24761 Opened 26 years ago Closed 26 years ago

[XBL] CPU usage spikes holding up arrow

Categories

(Core :: XUL, defect, P3)

x86
Linux
defect

Tracking

()

RESOLVED FIXED

People

(Reporter: dbaron, Assigned: hyatt)

Details

(Keywords: perf)

DESCRIPTION: When I hold down the up arrow key (while at the *top* of a page), my CPU usage meter spikes to 100% and stays there until well after I release it. STEPS TO REPRODUCE: * load a page * click in URL bar * click in page window * hold down up arrow * watch CPU meter ACTUAL RESULTS: * CPU usage spikes EXPECTED RESULTS: * keys handled quickly DOES NOT WORK CORRECTLY ON: * Linux, mozilla, build of 2000-01-19 or so ADDITIONAL INFORMATION: I got some profiler data on this problem using jprof (hacked a bit so it works for me...) and I found what seems to be the problem. In http://lxr.mozilla.org/seamonkey/source/rdf/content/src/nsXULKeyListener.cpp#1545 HandleEventUsingKeyset is calling SetNewDocument(), which is creating and destroying lots of JS stuff. This seems to be where almost all the time is being spent (this is out of about 940 stack traces, which also include a full shutdown, so it's about 90% of the time including the shutdown): 849 nsXULKeyListenerImpl::HandleEventUsingKeyset(nsIDOMElement *, nsIDOMKeyEvent *, eEventType, nsIDOMXULDocument *, int &) 1 DocumentViewerImpl::~DocumentViewerImpl(void) 35778 0 850 GlobalWindowImpl::SetNewDocument(nsIDOMDocument *) 472 nsJSContext::InitContext(nsIScriptGlobalObject *) 244 nsJSContext::GC(void) 134 JS_ClearScope If you want the whole profiler output, I could give it to you, although it's a big file (200K), and this really looks like the problem. The code was checked in by hyatt in December. A few other key snips from the output: 896 nsXULKeyListenerImpl::LocateAndExecuteKeyBinding(nsIDOMKeyEvent *, eEventType, nsIDOMXULDocument *, int &) 102841 4 896 nsXULKeyListenerImpl::HandleEventUsingKeyset(nsIDOMElement *, nsIDOMKeyEvent *, eEventType, nsIDOMXULDocument *, int &) 849 GlobalWindowImpl::SetNewDocument(nsIDOMDocument *) 15 nsXULElement::GetAttribute(nsString &, nsString &) 14 nsJSEventListener::HandleEvent(nsIDOMEvent *) 4 nsAutoString::nsAutoString(char *, int) 2 nsXULElement::GetNextSibling(nsIDOMNode **) 2 nsAutoString::~nsAutoString(void) 1 .LM4041 1 nsXULElement::GetNodeName(nsString &) 1 nsJSContext::BindCompiledEventHandler(void *, nsIAtom *, void *) 1 nsString::Equals(char *, int, int) const 1 nsString::operator!=(char *) const 1 nsString::ToUpperCase(void) 448 nsXULKeyListenerImpl::KeyUp(nsIDOMEvent *) 437 nsXULKeyListenerImpl::KeyDown(nsIDOMEvent *) 37 nsXULKeyListenerImpl::KeyPress(nsIDOMEvent *) 102837 2 922 nsXULKeyListenerImpl::DoKey(nsIDOMEvent *, eEventType) 901 nsXULKeyListenerImpl::LocateAndExecuteKeyBinding(nsIDOMKeyEvent *, eEventType, nsIDOMXULDocument *, int &) 16 nsXULKeyListenerImpl::GetKeyBindingDocument(nsCAutoString &, nsIDOMXULDocument **) 3 GlobalWindowImpl::GetPrivateParent(nsPIDOMWindow **)
reassigning to saari for triage
Assignee: trudelle → saari
The complete profile data can be found, when my computer is on, at http://dbaron.student.harvard.edu/~david/mozperf/keyup.html
Thanks for the profile!!! That is something we've been meaning to do but havn't had time to yet. Hyatt, you should look at this too, I don't think this is what we expected.
Status: NEW → ASSIGNED
Target Milestone: M14
Keywords: beta1
Hyatt wants this
Assignee: saari → hyatt
Status: ASSIGNED → NEW
Should be invalidated by the XBL switchover, i.e., this code will all go away soon. Hopefully in M14.
Status: NEW → ASSIGNED
marking as "XBL-related", since it will go away once XBL key bindings come online.
Summary: CPU usage spikes holding up arrow → [XBL] CPU usage spikes holding up arrow
Thanks for the profile. I went ahead and fixed this anyway since it was an easy change.
Status: ASSIGNED → RESOLVED
Closed: 26 years ago
Resolution: --- → FIXED
please ignore, massive spam giving jrgm@netscape.com backlog of XPToolkits resolved fixed bugs to verify
QA Contact: paulmac → jrgm
You need to log in before you can comment on or make changes to this bug.