Bug 443307 - Avoid reading preferences repeateadly inside the tree item expansion code
Summary: Avoid reading preferences repeateadly inside the tree item expansion code
Status: NEW
Alias: None
Product: Sirius
Classification: Modeling
Component: Core (show other bugs)
Version: 1.0.1   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Project inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords: performance, triaged
Depends on: 428756
Blocks: 442862
  Show dependency tree
 
Reported: 2014-09-04 08:19 EDT by Esteban DUGUEPEROUX CLA
Modified: 2014-09-08 08:28 EDT (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Esteban DUGUEPEROUX CLA 2014-09-04 08:19:10 EDT
It seems that calls to IPreferencesService methods can be time consumming. Then we must avoid call it in TreeItem expansion, especially when a huge hierarchy is expand with "*" shortcut on Windows.

Then to avoid that, autoRefresh preference value must be get once at DTreeViewerListener initialisation in a class field and a listener must be written to update this field on preference change.


Currently IPreferencesService is used but has not method to add a listener.
There is IPreferenceChangeListener but only applicable on IPreferenceStore of JFace which is then UI dependant.
There is also IEclipsePreferences on which we can have INodeChangeListener.

Then this bugzilla is to analyse what to do.
Comment 1 Alex Lagarde CLA 2014-09-04 09:35:33 EDT
I would change the scope of this issue to use a preference listener instead of systematically ask to the preference service everywhere it makes sence.

At least, auto-refresh value should be kept in a central cache and updated through a preference listener.

Marking issue as triaged as this is a valid feature request.
Comment 2 Pierre-Charles David CLA 2014-09-05 02:41:21 EDT
This is exactly in the scope of bug 442862, which was opened for the same issue in GroupingContentProvider, but in which we planned to look for other culprits in the code.

https://git.eclipse.org/r/#/c/32529/ proposes a solution for GroupinContentProvider which tries to be a little more general. I'm not sure if in its current state it can be reused for tree item expansion, but if it can't, it should be modified.
Comment 3 Pierre-Charles David CLA 2014-09-05 04:20:11 EDT
I've renamed this ticket to keep its scope on the tree item expansion part. I'll probably open a new one for the GroupingContentProvider case, so that bug 442862 can be kept for the general problem, and each individual case has its own ticket.
Comment 4 Pierre-Charles David CLA 2014-09-08 08:28:17 EDT
Note that this issue does not happen in the current master branch, but is a side-effect/followup of https://git.eclipse.org/r/#/c/22444/, a proposed change for bug 428756. Basically, if/when that change is merged, then this issue with preference accesses will probably need to be adressed to get more of the performance benefits.