Bug 152221

Summary: Web Inspector: Don't render console messages until Console is opened
Product: WebKit Reporter: Nikita Vasilyev <nvasilyev>
Component: Web InspectorAssignee: Nikita Vasilyev <nvasilyev>
Status: RESOLVED DUPLICATE    
Severity: Normal CC: bburg, giovanni.piller, graouts, joepeck, mattbaker, nvasilyev, timothy, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Local Build   
Hardware: All   
OS: All   
Bug Depends on:    
Bug Blocks: 152220    

Nikita Vasilyev
Reported 2015-12-12 21:40:54 PST
Running the following code make Web Inspector unbearably slow in a couple of minutes: setInterval(function() { console.log({x: Math.random()}) }, 200); The low hanging fruit would be to simply not update Console's DOM when it isn't visible, e.d. the split console is closed and the active tab isn't Console.
Attachments
Nikita Vasilyev
Comment 1 2015-12-12 22:14:35 PST
When the console isn't visible, the console content view is already not present in the DOM. However, https://github.com/WebKit/webkit/blob/master/Source/WebInspectorUI/UserInterface/Controllers/JavaScriptLogViewController.js#L276 WebInspector.JavaScriptLogViewController#_appendConsoleMessageView keeps appending elements regardless of that. When console isn't visible, it appends to a DOM element that is detached from the DOM: >> this._currentConsoleGroup.element.parentNode.parentNode.parentNode -> null I wonder if modifying detached DOM is still making Web Inspector slow.
Nikita Vasilyev
Comment 2 2015-12-12 22:27:27 PST
After profiling in Timelines I noticed that I get 4 paints (!) on every console.info call when the split console is closed! I intentionally used console.info instead of console.log that doesn't modify console message counts on the dashboard.
Nikita Vasilyev
Comment 3 2015-12-12 22:36:02 PST
I ran the following code in Firefox DevTools and Chrome DevTools for a couple of minutes: setInterval(function() { console.log({x: Math.random()}) }, 1); Both performed well — responsive and snappy. I profiled Chrome DevTools and it seems that they use a custom requestAnimationFrame batching. Firefox DevTools use React.js.
Radar WebKit Bug Importer
Comment 4 2016-05-02 02:05:14 PDT
Timothy Hatcher
Comment 5 2016-05-02 06:05:58 PDT
Isn't this a dupe?
Timothy Hatcher
Comment 6 2016-05-02 09:10:28 PDT
*** This bug has been marked as a duplicate of bug 155629 ***
Nikita Vasilyev
Comment 7 2016-05-02 11:50:32 PDT
(In reply to comment #5) > Isn't this a dupe? Yes, it is.
Note You need to log in before you can comment on or make changes to this bug.