Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » AbstractTreeViewer.add method performance.
AbstractTreeViewer.add method performance. [message #453249] Sat, 02 April 2005 05:03 Go to next message
Dimitry Fayerman is currently offline Dimitry FayermanFriend
Messages: 14
Registered: July 2009
Junior Member
When implementing deferred loading for the TreeViewer I stumbled upon serious performance problems in the
AbstractTreeViewer.add(Object parentElement, Object[] childElements) method.

The amount of time this method takes grows exponentially with the size of the childElements array.

After profiling it turns out that the problem is that the method is not optimized for loading multiple elements. It essentially adds each element separately.
The main problem is that getItems(Item) method is called several times for each element in the childElements array.
This method sends message to native Windows control to get children for a given item. The time it takes for getItems to execute grows exponentially with the each item added.

We do not have control over the performance of the native widgets but we can optimize calls to them.

I created OptimizedTreeViewer class that overrides the internalAdd method and uses a single call to getItems to load all the children.

The difference in performance is huge. To add 5000 items in the original tree is ~10 sec with my implementation it takes less then 1 sec.

The optimized class is attached.
Comments are appreciated.

Thanks.
Dimitry Fayerman


Re: AbstractTreeViewer.add method performance. [message #453250 is a reply to message #453249] Sat, 02 April 2005 10:07 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: bob.objfac.com

I'm just an observer, but you should really attach this code to a bug
report. When you do, (and I hope you do - many of us have suffered from
from TreeViewer's poor performance) note that AbstractTreeViewer is part
of JFace, not SWT. So your post would have been better addressed to the
eclipse.platform newsgroup. But never mind that, please do the bug
report and let the rest of us know the bug number. Thanks!

Bob Foster

Dimitry Fayerman wrote:
> When implementing deferred loading for the TreeViewer I stumbled upon serious performance problems in the
> AbstractTreeViewer.add(Object parentElement, Object[] childElements) method.
>
> The amount of time this method takes grows exponentially with the size of the childElements array.
>
> After profiling it turns out that the problem is that the method is not optimized for loading multiple elements. It essentially adds each element separately.
> The main problem is that getItems(Item) method is called several times for each element in the childElements array.
> This method sends message to native Windows control to get children for a given item. The time it takes for getItems to execute grows exponentially with the each item added.
>
> We do not have control over the performance of the native widgets but we can optimize calls to them.
>
> I created OptimizedTreeViewer class that overrides the internalAdd method and uses a single call to getItems to load all the children.
>
> The difference in performance is huge. To add 5000 items in the original tree is ~10 sec with my implementation it takes less then 1 sec.
>
> The optimized class is attached.
> Comments are appreciated.
>
> Thanks.
> Dimitry Fayerman
>
>
Re: AbstractTreeViewer.add method performance. [message #453251 is a reply to message #453250] Sat, 02 April 2005 12:26 Go to previous messageGo to next message
Dimitry Fayerman is currently offline Dimitry FayermanFriend
Messages: 14
Registered: July 2009
Junior Member
The bug number is 90073.
https://bugs.eclipse.org/bugs/show_bug.cgi?id=90073


You are right, I should have posted it in the platform forum.
Thanks.
Dimitry.

>>> Bob Foster<bob@objfac.com> 4/2/2005 5:07:09 AM >>>
I'm just an observer, but you should really attach this code to a bug
report. When you do, (and I hope you do - many of us have suffered from
from TreeViewer's poor performance) note that AbstractTreeViewer is part
of JFace, not SWT. So your post would have been better addressed to the
eclipse.platform newsgroup. But never mind that, please do the bug
report and let the rest of us know the bug number. Thanks!

Bob Foster

Dimitry Fayerman wrote:
> When implementing deferred loading for the TreeViewer I stumbled upon serious performance problems in the
> AbstractTreeViewer.add(Object parentElement, Object[] childElements) method.
>
> The amount of time this method takes grows exponentially with the size of the childElements array.
>
> After profiling it turns out that the problem is that the method is not optimized for loading multiple elements. It essentially adds each element separately.
> The main problem is that getItems(Item) method is called several times for each element in the childElements array.
> This method sends message to native Windows control to get children for a given item. The time it takes for getItems to execute grows exponentially with the each item added.
>
> We do not have control over the performance of the native widgets but we can optimize calls to them.
>
> I created OptimizedTreeViewer class that overrides the internalAdd method and uses a single call to getItems to load all the children.
>
> The difference in performance is huge. To add 5000 items in the original tree is ~10 sec with my implementation it takes less then 1 sec.
>
> The optimized class is attached.
> Comments are appreciated.
>
> Thanks.
> Dimitry Fayerman
>
>
Re: AbstractTreeViewer.add method performance. [message #453254 is a reply to message #453251] Sun, 03 April 2005 00:14 Go to previous message
Eclipse UserFriend
Originally posted by: bob.objfac.com

Dimitry Fayerman wrote:
> The bug number is 90073.
> https://bugs.eclipse.org/bugs/show_bug.cgi?id=90073

Thanks. I added myself to the cc and even voted for it. ;-}

Bob
Previous Topic:Problem with OLE automation and Microsof Excel
Next Topic:help me about the image redraw!
Goto Forum:
  


Current Time: Sat Oct 19 18:20:32 GMT 2019

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

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

Back to the top