This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
Left frame has a tree-like structure and the Right frame has the details of the selected node (just as in windows folders)
On the right frame, apart from the details ,there are a set of buttons which are of two kinds: (a)Buttons used to manipulate tree nodes itself like 'Add Node', 'Delete Node'(Tree state changes) Basically tree must be refreshed from DB to show the changed state (b)Buttons used to manipulate the node details (Tree state remains the same)
Issues: In case of say 30 nodes its fine but beyond that if the nodes are say 100 in number, then the page takes a lot of time to load(more than 8 seconds).
Also, when the tree refresh happens (in case of (a) above) it's even more slow.....(more than 12 seconds)
Right now I am using an arrayList for node population(We chose arrayList as out of about 18 functionalities, in only 3 - add/move/delete node, the tree state gets refreshed, otherwise for rest of the 15 functionalities the tree state remains the same)
Is there a better collection that may render better performance ? How may I address the performance issue?
How did you allocate the memory for the ArrayList? Did you try allocating a big chunk upfront?. How exactly do you process Add/Delete of nodes? If you are processing from scratch then you can think about operations like retaining the existing ArrayList minus deleted node or adding the new node. If you can paste the code it will help..
ArrayList operations are VERY fast, I'm sure your problem lies elsewhere. You might want to do some profiling, for instance with JAmon - (free). Bill
Joined: Apr 01, 2005
I actually did not allocate any memory before populating the ArrayList.
I would do the following: Given that I would have about 500 elements in the ArrayList, I would require to initialize with 500 elements before populating arrayList.
Please let me know if any other tuning is possible?
Author and all-around good cowpoke
Joined: Mar 22, 2000
To use the Texas vernacular "you are barking up the wrong tree" - any process taking more than a few milliseconds is NOT being held up by the operation of ArrayList functions. Perhaps your code is redrawing the screen after every addition - that can chew up some time, but my money is on ANY database operation. RIGHT NOW, before doing anything else! Go get JAMon and instrument your program to see whats really taking the time. Bill