Web Inspector: console view takes a long time to render if there are many messages
https://bugs.webkit.org/show_bug.cgi?id=136984
Summary Web Inspector: console view takes a long time to render if there are many mes...
Brian Burg
Reported 2014-09-21 14:31:51 PDT
It seems like we try to load up all the messages before showing the full-size console view. This is a problem if there are 100's of message in the console. (A good test case is using 2nd level inspector while dumping protocol traffic via the switch in InspectorBackend.) Since old output scrolls off the top, we should probably be showing the view immediately then incrementally rendering messages from newest to oldest.
Attachments
WIP (17.85 KB, patch)
2015-02-26 22:47 PST, Nikita Vasilyev
nvasilyev: review-
nvasilyev: commit-queue-
Radar WebKit Bug Importer
Comment 1 2014-09-21 14:31:58 PDT
Nikita Vasilyev
Comment 2 2015-02-25 00:13:55 PST
> A good test case is using 2nd level inspector while dumping protocol traffic via the switch in InspectorBackend. Could you explain how to do that? I’m not familiar with that switch. I’m in the process of rewriting console views (LogContentView.js, JavaScriptLogView.js, ConsoleGroup.js, etc.) and I’d like to fix all issues related to console’s slugishness.
Joseph Pecoraro
Comment 3 2015-02-25 00:33:42 PST
(In reply to comment #2) > > A good test case is using 2nd level inspector while dumping protocol traffic via the switch in InspectorBackend. > > Could you explain how to do that? I’m not familiar with that switch. He is referring to InspectorBackend.dumpInspectorProtocolMessages. Set that to true, and the 2nd level inspector will dump to console all frontend <-> backend traffic. --- Just a quick glance at the code: - InspectorConsoleAgent stores the last 1000 messages while no inspector is open - InspectorConsoleAgent::enable sends all of them to the frontend in order (old -> new)
Nikita Vasilyev
Comment 4 2015-02-26 13:59:58 PST
I’ll do progressive rendering, batching by something between 10 and 32 messages. 32 is number of one-line messages fitting in the console on my 15 inch MacBook Pro: https://cldup.com/vzs8ntl1ew.png
Timothy Hatcher
Comment 5 2015-02-26 14:03:16 PST
(In reply to comment #4) > I’ll do progressive rendering, batching by something between 10 and 32 > messages. 32 is number of one-line messages fitting in the console on my 15 > inch MacBook Pro: > https://cldup.com/vzs8ntl1ew.png Sounds good.
Nikita Vasilyev
Comment 6 2015-02-26 22:47:29 PST
Created attachment 247503 [details] WIP This patch does batch updates only 3 messages at the time because it’s easier to debug this way. Before looking at the patch, please note that I was in the middle of ConsoleGroup refactoring, which was intersected with this patch. Brian, let me know if it solves the original problem. Even with InspectorBackend.dumpInspectorProtocolMessages turned on, it was fairly fast for me, so I couldn’t quite reproduce it.
Nikita Vasilyev
Comment 7 2015-02-26 22:49:47 PST
s/was intersected/was intersecting/ (I’ll learn English grammar one day)
Timothy Hatcher
Comment 8 2015-03-04 16:59:59 PST
Comment on attachment 247503 [details] WIP View in context: https://bugs.webkit.org/attachment.cgi?id=247503&action=review So this batch updates on new messages but it does not cap the max messages we should in the DOM. I think it would still be good to cap the max we put in the DOM in the first place so switching to the console is fast and won't eat memory and slow down the UI with too many DOM nodes in the tree. > Source/WebInspectorUI/UserInterface/Controllers/JavaScriptLogViewController.js:282 > + this._batchUpdateId = requestAnimationFrame(function() { I would break out the inline function into a named function since it is large. It can still be a closure, just named. See NavigationSidebarPanel.js _checkForOldResources for an example (that uses setTimeout when we likely should consider using rAF more.) At first I wondered what _batchUpdateId was, I thought it was some id you used but it is the rAF id. I would put "TimeoutIdentifier" or "AnimationIdentifier" as a suffix. Also we spell out Identifier. https://trac.webkit.org/wiki/WebInspectorCodingStyleGuide#Namingthings > Source/WebInspectorUI/UserInterface/Controllers/JavaScriptLogViewController.js:315 > + //@nvasilyev: extra console.groupEnd() call can make console group go negative margin, not good. We should just ignore the extra then. Would be good to file a separate bug for that. > Source/WebInspectorUI/UserInterface/Controllers/JavaScriptLogViewController.js:331 > if (this.delegate && typeof this.delegate.didAppendConsoleMessage === "function") > this.delegate.didAppendConsoleMessage(msg); I wonder if this should fire only after the batch update?
Nikita Vasilyev
Comment 9 2016-05-02 12:00:13 PDT
With bug 155629 landed, now it's very straightforward to implement progressive rendering.
Note You need to log in before you can comment on or make changes to this bug.