If not being evicted, all your objects will reside in memory. What takes the time is 
the way you gonna access them.

Looking up a thousand Names first and then looking up a thousand Objects by name is 
pretty much the slowest way at all to do this.

This is like a paperboy that just delivers one paper at a time returning to his office 
to get the address of the next customer instead of making use of the fact that all 
customers live in houses that are neatly lined up in a row :-)

Doing it this way will be much faster:

  | Node myNode = myTree.get("/a/b");
  | Map allOfMyNodesChildren = myNode.getChildren();
  | Iterator it = allOfMyNodesChildren.entrySet().iterator();
  | 
  | while(it.hasNext()) {
  |    ...
  | }
  | 

Even faster would be if you implement a TreeCacheListener that stores references to 
all the objects in question in a vector you gonna iterate over. Keep in mind, as long 
we are not talking of Strings or explicit use of 'clone()' Java Objects are passed by 
reference and not copied. Therefore it's pretty cheap (in terms of memory and cpu-use) 
to keep a (redundant) list of references to your objects. All u have to make shure is, 
that u don't keep references of objects u want to be garbage-collected.

View the original post : 
http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3848910#3848910

Reply to the post : 
http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=3848910


-------------------------------------------------------
This SF.Net email is sponsored by: YOU BE THE JUDGE. Be one of 170
Project Admins to receive an Apple iPod Mini FREE for your judgement on
who ports your project to Linux PPC the best. Sponsored by IBM.
Deadline: Sept. 24. Go here: http://sf.net/ppc_contest.php
_______________________________________________
JBoss-Development mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-development

Reply via email to