[jbosstools-issues] [JBoss JIRA] (JBIDE-12948) SelectionBar uses too much CPU resources
Denis Maliarevich (JIRA)
jira-events at lists.jboss.org
Fri Oct 26 12:34:01 EDT 2012
[ https://issues.jboss.org/browse/JBIDE-12948?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12729497#comment-12729497 ]
Denis Maliarevich commented on JBIDE-12948:
-------------------------------------------
So the fix is:
1) initialize the toolbar size once on the creation time.
2) do not call {{this.getParent().layout(true, true);}} if the visibilty has not been changed.
It helped to reduce the time for running JsfAllTest from "652.178s" to "345.834s" on my machine (almost 2x faster).
> 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: Denis Maliarevich
> 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