Closed Bug 1348761 Opened 8 years ago Closed 8 years ago

Console hangs the browser when attempting to view a printed object

Categories

(DevTools :: Console, defect, P2)

defect

Tracking

(firefox55 fixed)

RESOLVED FIXED
Firefox 55
Tracking Status
firefox55 --- fixed

People

(Reporter: jujjyl, Assigned: ochameau)

References

Details

Attachments

(1 file)

STR: 1. Visit http://mzl.la/webassemblydemo 2. After the page loads, open Console devtool and type in "Module" and press enter. 3. The Module object gets printed to console. Click on the word "Module" to attempt to view that object in the console's "object explorer" view. Observed: The browser tab hangs. Tested to reproduce on FF 52 stable on OS Xand current FF Nightly on Windows 10.
Obviously we shouldn't be hanging, but note that there's work upcoming to drop the variables view in favor of expanding the object inline (Bug 1308566). We'll need to test this page with the new expansion ui and make sure that it doesn't hang there either. I did a quick test in the new Debugger (which is using the same upcoming expansion ui) by pausing and then setting 'Module' as a Watch Expression and attempting to expand, and it seems to have a similar problem. I filed https://github.com/devtools-html/debugger.html/issues/2671 for this.
Depends on: 1308566
Priority: -- → P2
Here is a profile: https://perfht.ml/2pHcwGK Most of the time is spent in grip function: http://searchfox.org/mozilla-central/source/devtools/server/actors/object.js#79-143 Then about 70% of that time is spent in: g.ownPropertyLength = this.obj.getOwnPropertyNames().length; Which is weird as it seems to be fast if you call Object.getOwnPropertyNames(Module).length. May be the Debugger API getOwnPropertyNames is slower?? The rest of the time, a bit less than 30% is spent in TypedArray: http://searchfox.org/mozilla-central/source/devtools/server/actors/object.js#1472-1504 Itself spending most of its time on Cu.cloneInto.
Note that it is easier to test against: http://www.hellorust.com/emscripten/sha1/ which doesn't introduce massive computation and slow down the profiler.
Oh, it looks like it isn't against Module object itself, but Module.HEAP* attributes which are big typed array. We end up retrieving grips for all attributes of Module, this is what takes time Object.getOwnPropertyNames(Module.HEAP8).length = 16777216 And takes more than a second to compute.
Assignee: nobody → poirot.alex
Comment on attachment 8860114 [details] Bug 1348761 - Fix object inspection performances against objects with large Typed Arrays. https://reviewboard.mozilla.org/r/132128/#review134984 Great find - this is much better! I think this will also fix https://github.com/devtools-html/debugger.html/issues/2671
Attachment #8860114 - Flags: review?(bgrinstead) → review+
Pushed by apoirot@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/934221c412fc Fix object inspection performances against objects with large Typed Arrays. r=bgrins
Status: NEW → RESOLVED
Closed: 8 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 55
See Also: → 1387823
Product: Firefox → DevTools
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: