Try lowering the priority of your background thread by calling.
Try lowering the priority of your background thread by calling this. SetPriority(this.getPriority()-1); in your Thread. 500 calls to asyncExec should not make the GUI unresponsive, if they don't do more than setting an Image in a TreeItem.To ensure, that your calls to TreeViewer.
Update are cheap, call TreeViewer. SetUseHashlookup(true) which enables efficient mapping of elements to TreeItems.
Accepted for TreeViewer. SetUseHashlookup(true) which is an obvious trick I missed. Other techniques (such as batching) tended not to improve performance.
– Andrew Mar 14 '11 at 10:26.
Sorry if I wasn't clear. The type can be 1 of 5 types each represented by an image. Each of these 5 images is already loaded in an ImageRegistry.
What's slow is deciding which image to display and then displaying it. – Andrew Mar 1 '11 at 14:31.
I would recommend the following optimization strategies (in order)... Batch update calls. That is, have a list into which you deposit content objects whose image has been calculated. When the list size arrives at a certain threshold (or you run out of objects), kick off an update of all the objects presently in the list.
Make sure to copy the contents of the list first and clear the list so that the caching thread can keep accumulating. Play around with the threshold parameter and you will likely get the perf you are after by reducing the number of asyncExec calls. If #1 is not sufficient by itself (unlikely), you may also want to consider optimizing around the viewable region.
Tree class has api around tracking which items are visible and you can listen for scroll events. The idea here is to prioritize image calculation for items that are visible and to call update on items only after they've become visible.
I would suggest loading/creating several images at once in the background thread (from what you said it sounds like you could do at least 10 w/o a performance issue). So your thread would look something like: // Load/Create some number of images... Display. AsyncExcec(new Runnable() { public void run() { getTreeViewer().
SetRedraw(false); // Loop and call update on each node you loaded the image for getTreeViewer(). SetRedraw(true); } }).
I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.