If you think a bug might affect users in the 57 release, please set the correct tracking and status flags for Release Management.

Change eventSource in dbg-client.jsm to use Set (and maybe Map) for listeners

RESOLVED WONTFIX

Status

()

Firefox
Developer Tools: Debugger
--
minor
RESOLVED WONTFIX
5 years ago
5 years ago

People

(Reporter: benvie, Assigned: benvie)

Tracking

21 Branch
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment)

(Assignee)

Description

5 years ago
eventSource currently uses a plain object to store the mapping of events to listeners, and the listener groups are arrays. eventSource.removeListener works by filtering the array of listeners and creating an entirely new array, so is inefficient (eventSource.addOneTimeListener uses this).

As the event handler methods tend to be hot code, I think it would worth optimizing by switching to Sets for the listeners instead of arrays. A more minor optimization would be to switch the events object to use a Map.
(Assignee)

Updated

5 years ago
Assignee: nobody → bbenvie
(Assignee)

Comment 1

5 years ago
Created attachment 725127 [details] [diff] [review]
initial attempt at converting to use Map and Set
(Assignee)

Comment 2

5 years ago
Since we're planning to migrate to using Addon SDK's EventEmitter, this is unneeded.
Status: NEW → RESOLVED
Last Resolved: 5 years ago
Resolution: --- → WONTFIX
You need to log in before you can comment on or make changes to this bug.