Bug 442903 - Optimize DAnalysisSession.getSelectedViewpoints()
Summary: Optimize DAnalysisSession.getSelectedViewpoints()
Status: NEW
Alias: None
Product: Sirius
Classification: Modeling
Component: Core (show other bugs)
Version: 1.0.0   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Project inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords: performance, triaged
Depends on:
Blocks:
 
Reported: 2014-08-29 11:34 EDT by Pierre-Charles David CLA
Modified: 2014-08-29 12:09 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Pierre-Charles David CLA 2014-08-29 11:34:33 EDT
The method DAnalysisSessionImpl.getSelectedViewpoints(boolean) is relatively costly, involing the creation of an ordered TreeSet based on a Comparator which does non-trivial work. It is not obvious to callers that such an innocent-looking getter method is costly, and thus it is sometimes called in loops (for example in oViewpointSelectionCallback.selectViewpoint(Viewpoint, Session, boolean, IProgressMonitor)).

The actual value only changes very rarely, we should see if it can not be cached, and recomputed only when needed (maybe even incrementaly).

In addition, obvious cases where callers invoke it inside a loop where the value will not change could be modified to invoke it once, outside the loop.