Bug 152221 - Web Inspector: Don't render console messages until Console is opened
Summary: Web Inspector: Don't render console messages until Console is opened
Status: RESOLVED DUPLICATE of bug 155629
Alias: None
Product: WebKit
Classification: Unclassified
Component: Web Inspector (show other bugs)
Version: WebKit Local Build
Hardware: All All
: P2 Normal
Assignee: Nikita Vasilyev
URL:
Keywords: InRadar
Depends on:
Blocks: 152220
  Show dependency treegraph
 
Reported: 2015-12-12 21:40 PST by Nikita Vasilyev
Modified: 2016-05-02 11:50 PDT (History)
8 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Nikita Vasilyev 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.
Comment 1 Nikita Vasilyev 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.
Comment 2 Nikita Vasilyev 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.
Comment 3 Nikita Vasilyev 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.
Comment 4 Radar WebKit Bug Importer 2016-05-02 02:05:14 PDT
<rdar://problem/26037238>
Comment 5 Timothy Hatcher 2016-05-02 06:05:58 PDT
Isn't this a dupe?
Comment 6 Timothy Hatcher 2016-05-02 09:10:28 PDT

*** This bug has been marked as a duplicate of bug 155629 ***
Comment 7 Nikita Vasilyev 2016-05-02 11:50:32 PDT
(In reply to comment #5)
> Isn't this a dupe?

Yes, it is.