Skip to Content.
Sympa Menu

xom-interest - Re: [XOM-interest] Possible ArrayList optimization

xom-interest AT lists.ibiblio.org

Subject: XOM API for Processing XML with Java

List archive

Chronological Thread  
  • From: Janek Bogucki <janekdb AT yahoo.co.uk>
  • To: Elliotte Rusty Harold <elharo AT metalab.unc.edu>, xom-interest <xom-interest AT lists.ibiblio.org>
  • Cc:
  • Subject: Re: [XOM-interest] Possible ArrayList optimization
  • Date: Sun, 11 May 2003 22:05:45 +0100 (BST)

--- Elliotte Rusty Harold <elharo AT metalab.unc.edu> wrote: > Internally XOM
uses ArrayLists to
hold both children and attributes.
> While debugging an unrelated test failure (I hate EBCDIC!) I noticed
> that these array lists are created by default with a capacity of 10.
> That means each Element object has at least 80 bytes of overhead that a
> lot of the time it doesn't need. I'm going to experiment with setting
> the initial capacity of both the elements and the attributes lists to 0
> and 1 and see if that cuts down on memory usage noticeably.
>
> Right now my memory tests are very rough. I have a couple of programs
> that run out of memory, and I want to see if i can get them to actually
> run without dumping the VM.
>
> I am a little worried that dropping the capacity might impact speed, so
> if anyone knows more about array list opitmization, please pipe up!
>
>
> --
> Elliotte
>

Is there any reason why an invocation of ArrayList.trimToSize (), after the
array has had all
items added to it, would be inappropriate? This would minimise the storage
cost.

Cheers,
Janek

__________________________________________________
Yahoo! Plus
For a better Internet experience
http://www.yahoo.co.uk/btoffer




Archive powered by MHonArc 2.6.24.

Top of Page