avalon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Anton Tagunov <atagu...@apache.org>
Subject Re[3]: Configuration reporting
Date Fri, 05 Sep 2003 20:00:06 GMT
Hello Berin and All!

AT> Just of academical interest: there may some easier ways then using
AT> Stack, for instance a StringBuffer could be used.


AT> With a StringBuffer the amount of memory used will be way less then
AT> for a Stack (in fact it will depend on the depth of the xml tree and
AT> the lenghes of element names).

On the second thought, well, if we package the path with every
configuration element, then really the buffer for our StringBuffer
we be reallocated each time. So in fact this probably will save
NO memory at all. If on the other hand the Stack uses an
String[] array of a proper length under the hood, then using a Stack
will really waste almost no memory, the array will just be filled
with element names (and element names are String that have been
allocated already anyway).

So the real wast of memory here is not maintaining the Stack but
keeping the path information for every element in the Configuration.


1) at the second glance Stack does not look a waste of memory

2) if we're worried about memory (and there may be good benefits
   in ultimately pushing Avalon on Java2ME) then we probably could
   think about constructing this info at runtime?

   Although the current Configuration has no analog of
   org.w3c.dom.Node.getParentNode(), it is theoretically
   possible to add parent information to Configuration
   and then the virtual path could be constructed only on
   demand, when there really is an error, not for every node

3) going along these lines it might be also pretty usefull to
   keep the filename as a separate string (allocated only once)
   and the line and column number as integers and pack this all
   into a single location string only on demand - when an error
   has happpend, not for every configuration node

Cheers, Anton

P.S. Stephen, you have recently reported that Merlin footprint
is around 2Mb, I wonder how much of this could be saved this way?
Well, probably little, but for J2ME, and keeping in mind that
Configuration is framework, not even a container..

To unsubscribe, e-mail: dev-unsubscribe@avalon.apache.org
For additional commands, e-mail: dev-help@avalon.apache.org

View raw message