Closed
Bug 711312
Opened 14 years ago
Closed 6 years ago
Key event listeners iterated over for every keystroke - consider hashtable lookup
Categories
(Core :: XBL, defect)
Core
XBL
Tracking
()
RESOLVED
WONTFIX
People
(Reporter: WeirdAl, Unassigned)
Details
(Keywords: perf)
In reading over XBL key event handling, it appears we iterate over every handler for every keystroke:
http://hg.mozilla.org/mozilla-central/diff/ad45243a5cd9/content/xbl/src/nsXBLEventHandler.cpp
I think it might be faster if the key event handlers were stored in a hashtable where the hashkeys were char codes. Specifically:
* Define an event listener array type (typedef nsCOMArray<nsIDOMEventListener> ListenerArray)
* Define a nsDataHashtable<PRUint32, ListenerArray> mKeyListeners;
* In nsXBLKeyEventHandler::ExecuteMatchedHandlers, look up the ListenerArray by the charCode we're so helpfully given, and if there isn't a match, bail out.
* If there is a match, iterate over the found ListenerArray.
* Remove the charCode test from nsXBLKeyEventHandler::Matches in nsXBLKeyEventHandler.h.
I don't know if this will really yield much of a perf improvement, but consider that there are many char codes (VK_DOWN, VK_UP, VK_PAGE_DOWN, VK_ENTER, VK_A, etc.) that will probably not match a given event listener.
| Reporter | ||
Updated•14 years ago
|
Status: NEW → UNCONFIRMED
Ever confirmed: false
Comment 1•6 years ago
|
||
XBL is now disabled in Firefox (Bug 1583314) and is in the process of being removed from Gecko (Bug 1566221), so closing bugs requesting changes to its implementation as wontfix.
Status: UNCONFIRMED → RESOLVED
Closed: 6 years ago
Resolution: --- → WONTFIX
You need to log in
before you can comment on or make changes to this bug.
Description
•