Closed Bug 1361140 Opened 8 years ago Closed 8 years ago

Keeping the browser console open slows down Firefox - _findActivityObject should use a Map

Categories

(DevTools :: Console, defect, P1)

defect

Tracking

(Performance Impact:none)

RESOLVED FIXED
Firefox 55
Iteration:
55.5 - May 15
Performance Impact none

People

(Reporter: florian, Assigned: bgrins)

References

(Blocks 1 open bug)

Details

(Whiteboard: [photon-performance])

Attachments

(1 file)

My browser became janky on a very fast macbook. I noticed I had forgotten a Browser Console window on another screen. I do expect some overhead when the console is open, but the profiler shows most of the CPU spent is wasted: - _findActivityObject dominates the profile: https://perfht.ml/2p2cjx7 45% / 1800ms of CPU spent in it. Looking at the code (http://searchfox.org/mozilla-central/rev/3dc6ceb42746ab40f1441e1e659ffb8f62ae78e3/devtools/shared/webconsole/network-monitor.js#1180) shows this is an inefficient loop that should be replaced with a map. - there is 237ms spent in QuerySelectorAll called from pruneOutputIfNecessary: https://perfht.ml/2p1ROke This is the code at http://searchfox.org/mozilla-central/rev/3dc6ceb42746ab40f1441e1e659ffb8f62ae78e3/devtools/client/webconsole/webconsole.js#2376 I think this querySelectorAll call done each time a new message is appended should be avoided, instead the code should keep an array of the nodes related to messages of the category, and just remove the first message of the category whenever a new message needs to be appended (or even better, batch these updates and remove 5 or 10 old messages at once, to reduce the amount of dom manipulations).
(In reply to Florian Quèze [:florian] [:flo] from comment #0) > My browser became janky on a very fast macbook. I noticed I had forgotten a > Browser Console window on another screen. I do expect some overhead when the > console is open, but the profiler shows most of the CPU spent is wasted: > > - _findActivityObject dominates the profile: https://perfht.ml/2p2cjx7 45% / > 1800ms of CPU spent in it. Looking at the code > (http://searchfox.org/mozilla-central/rev/ > 3dc6ceb42746ab40f1441e1e659ffb8f62ae78e3/devtools/shared/webconsole/network- > monitor.js#1180) shows this is an inefficient loop that should be replaced > with a map. Thanks, I'll pull this into ongoing console work > - there is 237ms spent in QuerySelectorAll called from > pruneOutputIfNecessary: https://perfht.ml/2p1ROke > This is the code at > http://searchfox.org/mozilla-central/rev/ > 3dc6ceb42746ab40f1441e1e659ffb8f62ae78e3/devtools/client/webconsole/ > webconsole.js#2376 > I think this querySelectorAll call done each time a new message is appended > should be avoided, instead the code should keep an array of the nodes > related to messages of the category, and just remove the first message of > the category whenever a new message needs to be appended (or even better, > batch these updates and remove 5 or 10 old messages at once, to reduce the > amount of dom manipulations). This specific issue will be obsolete once the new console frontend is enabled in the browser console
Summary: Keeping the console open slows down Firefox → Keeping the browser console open slows down Firefox due to _findActivityObject in webconsole/network-monitor.js
Flags: qe-verify?
Priority: -- → P2
Ah, I should have refreshed I guess... I broke out the `_findActivityObject` part into a separate Net Monitor bug 1361149.
(In reply to J. Ryan Stinnett [:jryans] (use ni?) from comment #2) > Ah, I should have refreshed I guess... I broke out the > `_findActivityObject` part into a separate Net Monitor bug 1361149. No problem, I think your bug title was more clear anyway - I'll dupe that one to this and rename.
Summary: Keeping the browser console open slows down Firefox due to _findActivityObject in webconsole/network-monitor.js → Keeping the browser console open slows down Firefox - _findActivityObject should use a Map
In case it helps, I've got a recent-ish Foxfooding profile from this use-case, up at https://perfht.ml/2pCmEkF.
Whiteboard: [photon-performance][qf] → [photon-performance][qf-]
Assignee: nobody → bgrinstead
Status: NEW → ASSIGNED
Priority: P2 → P1
Comment on attachment 8865139 [details] Bug 1361140 - Key openRequests and openResponses by channel instead of id for faster lookups; https://reviewboard.mozilla.org/r/136800/#review140072 Looks reasonable to me. Do you have any performance data showing how much this helps? Honza
Attachment #8865139 - Flags: review?(odvarko) → review+
(In reply to Jan Honza Odvarko [:Honza] from comment #7) > Comment on attachment 8865139 [details] > Bug 1361140 - Key openRequests and openResponses by channel instead of id > for faster lookups; > > https://reviewboard.mozilla.org/r/136800/#review140072 > > Looks reasonable to me. > > Do you have any performance data showing how much this helps? I don't think any of our existing perf tests will cover this nicely, but this should surely cause it to drop off of the reported profile (https://perfht.ml/2p2cjx7)
Pushed by bgrinstead@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/38f881e9f887 Key openRequests and openResponses by channel instead of id for faster lookups;r=Honza
Status: ASSIGNED → RESOLVED
Closed: 8 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 55
Iteration: --- → 55.5 - May 15
Depends on: 1363871
Flags: qe-verify? → qe-verify-
Product: Firefox → DevTools
Performance Impact: --- → -
Whiteboard: [photon-performance][qf-] → [photon-performance]
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: