Closed
Bug 1273511
Opened 9 years ago
Closed 9 years ago
Optimize EventListenerManager::AddEventListenerByType
Categories
(Core :: DOM: Events, defect)
Tracking
()
RESOLVED
FIXED
mozilla49
Tracking | Status | |
---|---|---|
firefox49 | --- | fixed |
People
(Reporter: smaug, Assigned: smaug)
References
Details
(Whiteboard: btpp-active)
Attachments
(2 files)
(deleted),
patch
|
masayuki
:
review+
|
Details | Diff | Splinter Review |
(deleted),
patch
|
masayuki
:
review+
|
Details | Diff | Splinter Review |
It does too many hashtable lookups and temporary string creations etc.
Comment 1•9 years ago
|
||
Also atomizations, free() calls... Lots of stuff in there.
Assignee | ||
Comment 2•9 years ago
|
||
yup, it all reduces to one hashtable lookup.
Assignee | ||
Comment 3•9 years ago
|
||
https://treeherder.mozilla.org/#/jobs?repo=try&revision=05b3bdb6e24afbc24c8f208f9ceb21f9e42dc785
This reduces the temporary string creation and hashtable lookups.
Attachment #8753390 -
Flags: review?(masayuki)
Comment 4•9 years ago
|
||
Comment on attachment 8753390 [details] [diff] [review]
patch
I don't like adding bool argument because it's not unclear from caller side. But I have no better idea.
Attachment #8753390 -
Flags: review?(masayuki) → review+
Assignee | ||
Comment 5•9 years ago
|
||
yeah, the method call is a bit ugly, but luckily this is used rarely. And since the method takes weird params anyhow, one needs to look at the documentation each time one uses it.
Updated•9 years ago
|
Whiteboard: btpp-active
Assignee | ||
Comment 6•9 years ago
|
||
Hmm, I need to look at the SVG/SMIL events. I may have made a mistake there.
https://treeherder.mozilla.org/#/jobs?repo=try&revision=5d47a2084eda
Assignee | ||
Comment 7•9 years ago
|
||
We pass the test current, and with this patch, but the previous patch didn't.
And yes, SVG/SMIL events are crazy.
(looks like try is closed atm)
Attachment #8754545 -
Flags: review?(masayuki)
Assignee | ||
Comment 8•9 years ago
|
||
Comment 9•9 years ago
|
||
Comment on attachment 8754545 [details] [diff] [review]
v2 + tests for SMIL/SVG
>+ if (sStringEventTable->Get(aName, &mapping)) {
>+ if (mapping.mMaybeSpecialSVGorSMILEvent) {
>+ // Try the atom version so that we should get the right message for
>+ // SVG/SMIL.
>+ atom = NS_Atomize(NS_LITERAL_STRING("on") + aName);
>+ msg = GetEventMessage(atom);
The events are not so many, so, it might be faster to use switch statement instead of hashtable. However, I guess that the hashtable's cost is not so better than switch statement and this is stronger for maintain.
I think that we should make the SVG/SMIL events constructed as usual in another bug, though.
Attachment #8754545 -
Flags: review?(masayuki) → review+
Comment 10•9 years ago
|
||
Comment 11•9 years ago
|
||
bugherder |
Status: NEW → RESOLVED
Closed: 9 years ago
status-firefox49:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla49
You need to log in
before you can comment on or make changes to this bug.
Description
•