Bug 95731 - Web Inspector: Timeline: cache "filteredRecords" for better scrolling performance.
Summary: Web Inspector: Timeline: cache "filteredRecords" for better scrolling perform...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Web Inspector (Deprecated) (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P2 Normal
Assignee: eustas.bug
URL:
Keywords:
Depends on:
Blocks: 95445
  Show dependency treegraph
 
Reported: 2012-09-04 04:14 PDT by eustas.bug
Modified: 2012-09-06 08:59 PDT (History)
13 users (show)

See Also:


Attachments
Patch (6.23 KB, patch)
2012-09-04 04:19 PDT, eustas.bug
no flags Details | Formatted Diff | Diff
Patch (6.69 KB, patch)
2012-09-05 01:18 PDT, eustas.bug
no flags Details | Formatted Diff | Diff
Patch (6.12 KB, patch)
2012-09-06 05:12 PDT, eustas.bug
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description eustas.bug 2012-09-04 04:14:16 PDT
Now scrolling is sluggish on large datasets.
Performance degrades, because each refresh causes DFS on all recorded items.

Solution: caching/invalidation of DFS (filtering) results.
Comment 1 eustas.bug 2012-09-04 04:19:58 PDT
Created attachment 162005 [details]
Patch
Comment 2 Andrey Kosyakov 2012-09-04 04:37:17 PDT
Comment on attachment 162005 [details]
Patch

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

> Source/WebCore/inspector/front-end/TimelinePanel.js:677
> +    _scheduleRefresh: function(preserveBoundaries, invalidateFilteredRecords)
>      {
> +        if (invalidateFilteredRecords)
> +            this._presentationModel.invalidateFilteredRecords();

Rather than passing additional bool to scheduleRefresh, can we instead perform invalidation on the call site?
You may want to extract this to a method like invalidateVisibleRecordsAndRefresh()
Comment 3 eustas.bug 2012-09-05 01:18:39 PDT
Created attachment 162183 [details]
Patch
Comment 4 Andrey Kosyakov 2012-09-05 08:28:11 PDT
Comment on attachment 162183 [details]
Patch

LGTM
Comment 5 Yury Semikhatsky 2012-09-06 01:19:07 PDT
Comment on attachment 162183 [details]
Patch

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

> Source/WebCore/inspector/front-end/TimelinePanel.js:638
> +        this._automaticallySizeWindow = this._automaticallySizeWindow || !preserveAutomaticallySizeWindow;

Could you explain this part?
Comment 6 Andrey Kosyakov 2012-09-06 01:20:56 PDT
Comment on attachment 162183 [details]
Patch

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

>> Source/WebCore/inspector/front-end/TimelinePanel.js:638
>> +        this._automaticallySizeWindow = this._automaticallySizeWindow || !preserveAutomaticallySizeWindow;
> 
> Could you explain this part?

@eustas: can we instead unconditionally set this to false in repopulate? If we needed automatic resize, this should have happened by now and we would just need to preserve the window?
Comment 7 Pavel Feldman 2012-09-06 02:01:33 PDT
As with any optimization that makes the code more complex, please provide some metrics for most common scenarios that prove speed ups. Why do we dfs at the first place? Should we bisect records in case of no glueing? Can we bisect with gliding? Caching has no real benefit, it will only eat memory here imo.
Comment 8 eustas.bug 2012-09-06 02:09:10 PDT
(In reply to comment #7)
> As with any optimization that makes the code more complex, please provide some metrics for most common scenarios that prove speed ups. Why do we dfs at the first place? Should we bisect records in case of no glueing? Can we bisect with gliding? Caching has no real benefit, it will only eat memory here imo.

In this case caching provides almost 10x performance boost (90ms -> 9ms on large dataset).

DFS is used, because visibility of child records is independent of visibility of parent records.

Of course "filteredRecords" could/would/should be optimized, but this patch is the first step.

With this patch scrolling becomes much-much smoother.
Comment 9 Pavel Feldman 2012-09-06 02:16:18 PDT
OK, patch concept lgtm. But in reality instead of scrolling users will adjust window. We should bisect time instead of linear searching. That would fix all scenarios.
Comment 10 Andrey Kosyakov 2012-09-06 02:40:30 PDT
(In reply to comment #9)
> OK, patch concept lgtm. But in reality instead of scrolling users will adjust window. We should bisect time instead of linear searching. That would fix all scenarios.

Why I agree we should bisect for window selection, it doesn't cover all the scenarios -- we also have filtering on type and (coming up) search. I don't think caching really "eats memory" here -- re-allocating the same array each time we scroll/resize actually does more harm, as we thrash the GC.
Comment 11 eustas.bug 2012-09-06 05:12:45 PDT
Created attachment 162479 [details]
Patch
Comment 12 Andrey Kosyakov 2012-09-06 05:15:40 PDT
Comment on attachment 162479 [details]
Patch

LGTM
Comment 13 WebKit Review Bot 2012-09-06 08:59:46 PDT
Comment on attachment 162479 [details]
Patch

Clearing flags on attachment: 162479

Committed r127746: <http://trac.webkit.org/changeset/127746>
Comment 14 WebKit Review Bot 2012-09-06 08:59:50 PDT
All reviewed patches have been landed.  Closing bug.