|
Re: AbstractTreeViewer.add method performance. [message #453250 is a reply to message #453249] |
Sat, 02 April 2005 10:07 |
Eclipse User |
|
|
|
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
>
>
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.04662 seconds