Bug 539724 - ContainerCheckedTreeViewer performance is bad
Summary: ContainerCheckedTreeViewer performance is bad
Status: RESOLVED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 4.9   Edit
Hardware: PC Windows 10
: P3 normal (vote)
Target Milestone: 4.11 M3   Edit
Assignee: Michael Keppler CLA
QA Contact:
URL:
Whiteboard:
Keywords: performance
Depends on:
Blocks:
 
Reported: 2018-10-02 07:44 EDT by Michael Keppler CLA
Modified: 2020-04-29 17:02 EDT (History)
4 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Michael Keppler CLA 2018-10-02 07:44:39 EDT
ContainerCheckedTreeViewer has really bad performance (at least on Windows).

Real world reproduction steps:
* Open a target platform editor (with some hundred plugins in the target platform, as for a typical eclipse.org project) and wait for the platform to resolve.
* Switch to the "Content" tab.
* Enable "Group by location". Application is blocked for several seconds (specific measurement: the egit-4.6 target editor is blocked for 24 CPU seconds on my machine, according to Yourkit)
* start typing in the filter text above the tree. After each character the application is blocked for several seconds again.

Root cause analysis:
* setCheckedElements(...) sets all the currently checked checkboxes after each UI change. that is fine.
* it calls doCheckStateChanged(), which in turn updates all parents, updates all children, and accesses all siblings of each item. Each of those operations needs 1 to 3 calls into the operating systems native widgets to get the checked/grayed state of the checkbox
* In practice for a tree with all (or almost all boxes checked) that leads to a runtime near O(n^2) on every call to setChecked(...), and the CPU time is bound by the window system calls for getting the items and their state.

The optimization approach is rather simple: Stop iterating the child and parent hierarchies when the checked/grayed state of the current item does not change.
Comment 1 Eclipse Genie CLA 2018-10-24 01:14:31 EDT
New Gerrit change created: https://git.eclipse.org/r/131391
Comment 3 Andrey Loskutov CLA 2019-07-24 09:10:51 EDT
(In reply to Eclipse Genie from comment #2)
> Gerrit change https://git.eclipse.org/r/131391 was merged to [master].
> Commit:
> http://git.eclipse.org/c/platform/eclipse.platform.ui.git/commit/
> ?id=a5aaefcf0abee77050e7ef214ba88ded04727a9e

This change caused functional regression in 4.11, see bug 548645.

Karsten, Lars, Michael: please check bug 548645 and provide a fix - or revert this patch.
Comment 4 Julian Honnen CLA 2019-07-26 07:17:39 EDT
(In reply to Andrey Loskutov from comment #3)
> Karsten, Lars, Michael: please check bug 548645 and provide a fix - or
> revert this patch.

reverting would be bad for PDE... I'll take a look.