[jbosstools-issues] [JBoss JIRA] (JBIDE-12948) SelectionBar uses too much CPU resources

Yahor Radtsevich (JIRA) jira-events at lists.jboss.org
Fri Oct 26 07:22:01 EDT 2012


Yahor Radtsevich created JBIDE-12948:
----------------------------------------

             Summary: SelectionBar uses too much CPU resources
                 Key: JBIDE-12948
                 URL: https://issues.jboss.org/browse/JBIDE-12948
             Project: Tools (JBoss Tools)
          Issue Type: Sub-task
          Components: Visual Page Editor core
    Affects Versions: 4.0.0.Beta1
            Reporter: Yahor Radtsevich
            Assignee: Yahor Radtsevich
             Fix For: 4.0.0.CR1


While profiling VPE JUnits it seems that up to 70% of all time of their execution is performed in the method org.jboss.tools.jst.jsp.selection.bar.SelectionBar.setVisible(boolean): 
{code}
public void setVisible(boolean visible) {
		if (visible) {
			splitter.setVisible(realBar, true);
			splitter.setVisible(emptyBar, false);
		} else {
			splitter.setVisible(realBar, false);
			splitter.setVisible(emptyBar, true);
		}
		
		/* JBIDE-7387:
		 * By default toolbar size is set to fit regular button ToolItems.
		 * But drop-down items are a little bigger and do not
		 * fit in the default-size toolbars (at least under Windows XP).
		 * This temporary ToolItem is needed to set enough size to the toolbar.*/
		ToolItem tempItem = new ToolItem(toolbar, SWT.DROP_DOWN);
		tempItem.setText(" "); //$NON-NLS-1$
		tempItem.setEnabled(false);
		this.getParent().layout(true, true);
		tempItem.dispose();
	}
{code} 

The call of {{this.getParent().layout(true, true);}} is very expensive.

I could suggest two fixes here:
# The panel should know if it is already visible or not. If the same state is requested, the method should do nothing.
# [Optionally!] Calculate the height of the toolbar only once, and then just pass this height to the layout manager.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira


More information about the jbosstools-issues mailing list