[jdom-interest] JDOM Stack vs. Frame Performance?
Todd.McFarland at fmr.com
Thu Dec 21 05:03:36 PST 2000
I have a question that is probably a Java question in general.
I'm noticing poor performance on objects (Including JDOM) I'm trying to
create on the stack
as opposed to private variables (Frame).
For example - if I declare a JDOM doc locally to a function and load a large
XML file, and then
pass its reference to another function and recurse through its nodes.
Performance is relatively terrible in the Servlet.
I then tried two simple changes and I was really surprised:
1. I moved the declaration (only) to a private variable. Performance was
still awful because I was still
passing the private variable as references to other functions (just
2. I eliminated the unnecessary object reference from the call to the other
functions - performance was excellent.
I'm noticing this kind of behavior on other objects as well.
Please note - I'm actually a C++/VB guy so I'm not a real Java expert. To
me, it looks like a memory
allocation issue. Can anyone comment?
More information about the jdom-interest