Bug 174968 - Web Inspector: add TreeElement virtualization for the Recording tab
Summary: Web Inspector: add TreeElement virtualization for the Recording tab
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Web Inspector (show other bugs)
Version: WebKit Nightly Build
Hardware: All All
: P2 Normal
Assignee: Devin Rousso
URL:
Keywords: InRadar
Depends on: 174484
Blocks: WebInspectorCanvasRecording 176547 183015 188959 188960
  Show dependency treegraph
 
Reported: 2017-07-28 22:16 PDT by Devin Rousso
Modified: 2018-08-26 20:44 PDT (History)
5 users (show)

See Also:


Attachments
Patch (10.29 KB, patch)
2017-08-01 23:48 PDT, Devin Rousso
no flags Details | Formatted Diff | Diff
Archive of layout-test-results from ews115 for mac-elcapitan (2.07 MB, application/zip)
2017-08-02 08:59 PDT, Build Bot
no flags Details
Patch (10.53 KB, patch)
2017-08-02 20:39 PDT, Devin Rousso
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Devin Rousso 2017-07-28 22:16:11 PDT
When a single frame has over ~3000 actions, it becomes very slow, bordering on unusable.  The main reason for this slowdown is the massive number of DOM elements, so adding/removing them depending on what's visible (plus some extra buffer) would drastically improve performance.
Comment 1 Devin Rousso 2017-08-01 23:48:46 PDT
Created attachment 316936 [details]
Patch
Comment 2 Build Bot 2017-08-02 08:59:04 PDT
Comment on attachment 316936 [details]
Patch

Attachment 316936 [details] did not pass mac-debug-ews (mac):
Output: http://webkit-queues.webkit.org/results/4240134

New failing tests:
fast/dom/Window/HTMLBodyElement-window-eventListener-attributes.html
Comment 3 Build Bot 2017-08-02 08:59:05 PDT
Created attachment 316964 [details]
Archive of layout-test-results from ews115 for mac-elcapitan

The attached test failures were seen while running run-webkit-tests on the mac-debug-ews.
Bot: ews115  Port: mac-elcapitan  Platform: Mac OS X 10.11.6
Comment 4 Devin Rousso 2017-08-02 11:00:35 PDT
Comment on attachment 316936 [details]
Patch

Unrelated test failure.
Comment 5 Joseph Pecoraro 2017-08-02 20:14:39 PDT
Comment on attachment 316936 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=316936&action=review

r=me, we should apply this to the CallStackTreeOutline in the debugger tab, which will need narrowing down of the scroll container.

> Source/WebInspectorUI/ChangeLog:18
> +        the TreeOutline node still takes up the same amount of space after some of the TreeElement's

Grammar: "TreeElement's" => "TreeElements"

> Source/WebInspectorUI/UserInterface/Views/TreeElement.js:466
> +        if (this.treeOutline)
> +            this.treeOutline.updateVirtualizedElements(this);

Move this after the onreveal.

> Source/WebInspectorUI/UserInterface/Views/TreeOutline.js:648
> +        if (isNaN(treeItemHeight))

Just console.assert !NaN

> Source/WebInspectorUI/UserInterface/Views/TreeOutline.js:666
> +        function walk(parent, callback) {

When walk recurses, the shouldReturn callback might return `true`, and then we will continue to walk when we un-nest the recursion.

You can solve this with 2 return values:

    {shouldReturn, count}

Or avoid recursion and do some cool iterative stack based solution.

> Source/WebInspectorUI/UserInterface/Views/TreeOutline.js:688
> +        let extraRows = Math.max(numberToShow * 5, 50);

This variable name is vague since you end up doing (extraRows * 2) all over the place. This is the number of pad rows you are applying to each side.

> Source/WebInspectorUI/UserInterface/Views/TreeOutline.js:697
> +            let index = walk(this, ({treeElement, count}) => {
> +                if (treeElement === focusedTreeElement)
> +                    return true;
> +                return false;
> +            });

Style: Simplify this

    let index = walk(this, ({treeElement}) => treeElement === focusedTreeElement);

> Source/WebInspectorUI/UserInterface/Views/TreeOutline.js:703
> +            }
> +            else if (index > lastItem) {

Style: else on the same line

> Source/WebInspectorUI/UserInterface/Views/TreeOutline.js:720
> +        this._virtualizedTopSpacer.style.setProperty("height", (Math.max(firstItem, 0) * this._virtualizedTreeItemHeight) + "px");

Why not just: style.height = ...;
Comment 6 Devin Rousso 2017-08-02 20:39:11 PDT
Created attachment 317082 [details]
Patch
Comment 7 WebKit Commit Bot 2017-08-02 21:21:35 PDT
Comment on attachment 317082 [details]
Patch

Clearing flags on attachment: 317082

Committed r220180: <http://trac.webkit.org/changeset/220180>
Comment 8 WebKit Commit Bot 2017-08-02 21:21:37 PDT
All reviewed patches have been landed.  Closing bug.
Comment 9 Radar WebKit Bug Importer 2017-08-02 21:22:31 PDT
<rdar://problem/33693047>