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

RESOLVED WONTFIX

Status

--
minor
RESOLVED WONTFIX
6 years ago
7 months ago

People

(Reporter: bbenvie, Assigned: bbenvie)

Tracking

21 Branch

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment)

(Assignee)

Description

6 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

6 years ago
Assignee: nobody → bbenvie
(Assignee)

Comment 1

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

Comment 2

6 years ago
Since we're planning to migrate to using Addon SDK's EventEmitter, this is unneeded.
Status: NEW → RESOLVED
Last Resolved: 6 years ago
Resolution: --- → WONTFIX

Updated

7 months ago
Product: Firefox → DevTools
You need to log in before you can comment on or make changes to this bug.