Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 370758 - [performance] Switching views: 30% of CPU goes on toolbar re-layout
Summary: [performance] Switching views: 30% of CPU goes on toolbar re-layout
Status: CLOSED DUPLICATE of bug 370337
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 4.2   Edit
Hardware: PC Windows 7
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Oleg Besedin CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-02-06 14:21 EST by Oleg Besedin CLA
Modified: 2012-02-06 17:02 EST (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Oleg Besedin CLA 2012-02-06 14:21:32 EST
Testing switching between views, I noticed that about 30% of the time goes into toolbars being recreated.

The trigger point is:

ToolBarManagerRenderer
	private boolean processAddition(final MToolBar toolbarModel, ...
	...
		parentContext.runAndTrack(new RunAndTrack() {
	...
			record.updateVisibility(parentContext.getActiveLeaf());
			manager.update(true);
	...

Those RaTs use #getActiveLeaf() and, hence, are called every time active part changes. 

The call to ToolBarManager#update() disposes and re-creates the toolbar.

To reiterate, this code causes each and every toolbar to be completely re-created on every change in the active part, possibly more than one time, regardless of where any visibility changed occurred in toolbar elements.
Comment 1 Oleg Besedin CLA 2012-02-06 14:29:50 EST
There are several points to consider in there:

1) Do we really need to use active leaf context? Could we use context of the toolbar container instead?

2) Can we limit calls to ToolBarManager#update() to cases where we actually had some visibly changed?

3) We have multiple RaTs that are getting called more than once for every view switch. It seems that while debugging SDK I get about 10 RaTs each called 3 - 5 times. Both of those numbers seem high.
Comment 2 Oleg Besedin CLA 2012-02-06 16:53:43 EST
I made a patch and discovered that Remy fixed this on Thursday in bug 370337.

Well, great minds think alike :-).

*** This bug has been marked as a duplicate of bug 370337 ***
Comment 3 Remy Suen CLA 2012-02-06 17:02:23 EST
(In reply to comment #2)
> I made a patch and discovered that Remy fixed this on Thursday in bug 370337.

Go, go, performance fixes! :)