Closed Bug 1827909 Opened 2 years ago Closed 2 years ago

Use mutable maps in sources reducer

Categories

(DevTools :: Debugger, enhancement)

enhancement

Tracking

(firefox114 fixed)

RESOLVED FIXED
114 Branch
Tracking Status
firefox114 --- fixed

People

(Reporter: ochameau, Assigned: ochameau)

References

Details

Attachments

(3 files, 1 obsolete file)

Work on bug 1822301 highlights that many maps in sources reducers are cloned on each state change for no good reason.
We could probably improve performance by using mutable maps and simplify a few things by storing source/source actor objects instead of their IDs.

This map is only used for removeThread action and we never return the
content of this map as-is. So we can use mutable data here.
For the map and the array values.

We were never returning list of source IDs as-is.
We are only returning the first source in the array,
or lookup for a precise one.

So we can use a mutable Map and also use mutable array as values.
Also, we could store source objects instead of IDs in order to
prevent doing lots of ID to source lookups.
Source objects are immutable so it is safe storing them.

Instead of storing a subset of attributes, it would drastically simplify things
to store the source actors objects. These objects are immutable so it is safe
to store them into the reducer.
It will prevent having to do many ID to object lookup!

We never return the map as result of a selector,
but we returns map's values.
So ensure still cloning array values everytime we register
a new source actor.

Comment on attachment 9328833 [details]
Bug 1827909 - [devtools] Store source actor objects in sources reducer's actors map.

Revision D175642 was moved to bug 1822301. Setting attachment 9328833 [details] to obsolete.

Attachment #9328833 - Attachment is obsolete: true
Pushed by apoirot@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/cc09f130b8b2 [devtools] Use mutable map for generated to original source mapping. r=devtools-reviewers,nchevobbe https://hg.mozilla.org/integration/autoland/rev/e60f901934f3 [devtools] Use mutable map for sources per URL. r=devtools-reviewers,nchevobbe https://hg.mozilla.org/integration/autoland/rev/c69b5c3323bf [devtools] Use mutable map to store sources actors per source ID. r=devtools-reviewers,nchevobbe
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: