Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse 4 » Expensive updates of ToolItems
Expensive updates of ToolItems [message #879949] Fri, 01 June 2012 07:31 Go to next message
Marko Herchet is currently offline Marko Herchet
Messages: 11
Registered: May 2012
Junior Member
Hi,

while working with e4 I realized, that org.eclipse.e4.ui.workbench.renderers.swt.HandledContributionItem.updateItemEnablement() is called about once a second for every ToolItem in my MainToolbar. This leads to HandledContributionItem.updateIcons(). I think this call is needed here to switch between enabled/disabled icons. But even if there is no change the icon bytes are requested via iconURI and a new SWT Image is created everytime.
A similar problem exists for the labels and tooltips, which are newly translated via TranslationService on every updateItemEnablement-call.

Is this a bug? Or required by some reason I don't see yet?

Marko
Re: Expensive updates of ToolItems [message #879956 is a reply to message #879949] Fri, 01 June 2012 07:45 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas Schindl
Messages: 5434
Registered: July 2009
Senior Member
File a bugzilla - this update should be as lightweight as possible.

Tom

Am 01.06.12 09:31, schrieb Marko Herchet:
> Hi,
>
> while working with e4 I realized, that
> org.eclipse.e4.ui.workbench.renderers.swt.HandledContributionItem.updateItemEnablement()
> is called about once a second for every ToolItem in my MainToolbar. This
> leads to HandledContributionItem.updateIcons(). I think this call is
> needed here to switch between enabled/disabled icons. But even if there
> is no change the icon bytes are requested via iconURI and a new SWT
> Image is created everytime.
> A similar problem exists for the labels and tooltips, which are newly
> translated via TranslationService on every updateItemEnablement-call.
>
> Is this a bug? Or required by some reason I don't see yet?
>
> Marko
Re: Expensive updates of ToolItems [message #880062 is a reply to message #879956] Fri, 01 June 2012 10:54 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas Schindl
Messages: 5434
Registered: July 2009
Senior Member
Well the image is not recreated it's the same instance all the time
because it is retrieved from the resource manager.

Tom

Am 01.06.12 09:45, schrieb Tom Schindl:
> File a bugzilla - this update should be as lightweight as possible.
>
> Tom
>
> Am 01.06.12 09:31, schrieb Marko Herchet:
>> Hi,
>>
>> while working with e4 I realized, that
>> org.eclipse.e4.ui.workbench.renderers.swt.HandledContributionItem.updateItemEnablement()
>> is called about once a second for every ToolItem in my MainToolbar. This
>> leads to HandledContributionItem.updateIcons(). I think this call is
>> needed here to switch between enabled/disabled icons. But even if there
>> is no change the icon bytes are requested via iconURI and a new SWT
>> Image is created everytime.
>> A similar problem exists for the labels and tooltips, which are newly
>> translated via TranslationService on every updateItemEnablement-call.
>>
>> Is this a bug? Or required by some reason I don't see yet?
>>
>> Marko
>
Re: Expensive updates of ToolItems [message #880171 is a reply to message #880062] Fri, 01 June 2012 14:52 Go to previous messageGo to next message
Marko Herchet is currently offline Marko Herchet
Messages: 11
Registered: May 2012
Junior Member
Ok Tom you are right. The URLImageDescriptor is created on every call but createImage() is never called because a cached image is already maped for the URLImageDescriptor.

Thanks for your help
Re: Expensive updates of ToolItems [message #901822 is a reply to message #879956] Tue, 14 August 2012 17:17 Go to previous messageGo to next message
Karen Butzke is currently offline Karen Butzke
Messages: 220
Registered: July 2009
Senior Member
Hi Tom,
Could you explain why this updateItemEnablement is needed? It is being called on a timer every 400ms and is expensive just because it's running on the UI thread. Is this covering up other bugs? Is it possible that you could do less on the UI thread?

I can enter a bug for this issue, I was just hoping for some more explanation. I still think it's a problem even though the images are not really being recreated every time. At the least the updateIcons could be performance tweaked, in the best case scenario it doesn't need to be called on the UI thread or called constantly.

I have attached a snapshot from jvisualvm showing a few seconds of time doing nothing in a Java perspective with open java editors.

Thanks,
Karen
Re: Expensive updates of ToolItems [message #901860 is a reply to message #901822] Tue, 14 August 2012 19:18 Go to previous messageGo to next message
Sopot Cela is currently offline Sopot Cela
Messages: 597
Registered: December 2010
Senior Member

This issue is already solved with a better approach and will be included in the next builds. Would be great if you could participate in testing it.See https://bugs.eclipse.org/bugs/show_bug.cgi?id=386070 and the related RGB leak bug.
Re: Expensive updates of ToolItems [message #901884 is a reply to message #901822] Tue, 14 August 2012 21:27 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas Schindl
Messages: 5434
Registered: July 2009
Senior Member
Hi Karen,

IMHO we should switch from the timerExec to a RunAndTrack approach but
I'm not too familiar with the code.

For my JavaFX rendering I'm for now going the RAT-Route to see how that
works out.

Tom

Am 14.08.12 19:17, schrieb Karen Butzke:
> Hi Tom,
> Could you explain why this updateItemEnablement is needed? It is being called on a timer every 400ms and is expensive just because it's running on the UI thread. Is this covering up other bugs? Is it possible that you could do less on the UI thread?
>
> I can enter a bug for this issue, I was just hoping for some more explanation. I still think it's a problem even though the images are not really being recreated every time. At the least the updateIcons could be performance tweaked, in the best case scenario it doesn't need to be called on the UI thread or called constantly.
>
> I have attached a snapshot from jvisualvm showing a few seconds of time doing nothing in a Java perspective with open java editors.
>
> Thanks,
> Karen
>
Re: Expensive updates of ToolItems [message #902025 is a reply to message #901860] Wed, 15 August 2012 14:19 Go to previous messageGo to next message
Karen Butzke is currently offline Karen Butzke
Messages: 220
Registered: July 2009
Senior Member
Thanks, i didn't see the bug since I was only searching for open ones! Performance looks much better now, thanks!

I see one issue with the main toolbar, which I don't know if it was caused by this bug or not. The separators are gone now and the toolbar sections are spread out. I have attached 2 screen shots showing the problem

Re: Expensive updates of ToolItems [message #902028 is a reply to message #902025] Wed, 15 August 2012 14:32 Go to previous messageGo to next message
Sopot Cela is currently offline Sopot Cela
Messages: 597
Registered: December 2010
Senior Member

No the timer thing has no connection with the toolbar glitch. That's because the commit on bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=340695 and it should be fixed on the next I-build i guess.
Re: Expensive updates of ToolItems [message #912474 is a reply to message #902028] Thu, 13 September 2012 16:32 Go to previous message
Karen Butzke is currently offline Karen Butzke
Messages: 220
Registered: July 2009
Senior Member
The toolbar layout is still broken in SR1 RC2. See my above screenshots. This is a regression from the 4.2 release to the SR1 RC2. https://bugs.eclipse.org/bugs/show_bug.cgi?id=340695 has not been fixed.
Previous Topic:QuickAccess contribution and activities
Next Topic:RCP Application
Goto Forum:
  


Current Time: Fri Oct 31 12:57:27 GMT 2014

Powered by FUDForum. Page generated in 0.02078 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software