xom-interest AT lists.ibiblio.org
Subject: XOM API for Processing XML with Java
List archive
Re: [XOM-interest] Possible ArrayList optimization
- From: dirk bergstrom <dirk AT juniper.net>
- To: Elliotte Rusty Harold <elharo AT metalab.unc.edu>
- Cc: xom-interest <xom-interest AT lists.ibiblio.org>
- Subject: Re: [XOM-interest] Possible ArrayList optimization
- Date: Mon, 12 May 2003 19:52:24 -0700
On 05/12/2003 07:14 PM, Elliotte Rusty Harold was heard to exclaim:
>>Is there any reason why an invocation of ArrayList.trimToSize (),
> I hadn't thought of that. How expensive is trimToSize()?
fairly cheap. about the same cost as extending the array. here's the source:
public void trimToSize() {
modCount++;
int oldCapacity = elementData.length;
if (size < oldCapacity) {
Object oldData[] = elementData;
elementData = new Object[size];
System.arraycopy(oldData, 0, elementData, 0, size);
}
}
> and you might be able to make that up by not having to
> constantly grow the arrays as you build the document. Just start them
> fairly large, and then chop it down when you're finished.
well, you probably don't want to start too big, since as you build a
document you'll have un-trimmed ArrayLists for many of the nodes.
--
Dirk Bergstrom dirk AT juniper.net
_____________________________________________
Juniper Networks Inc., Computer Geek
Tel: 408.745.3182 Fax: 408.745.8905
-
Re: [XOM-interest] Possible ArrayList optimization
, (continued)
-
Re: [XOM-interest] Possible ArrayList optimization,
dirk bergstrom, 05/09/2003
-
Re: [XOM-interest] Possible ArrayList optimization,
Elliotte Rusty Harold, 05/09/2003
- Re: [XOM-interest] Possible ArrayList optimization, Elliotte Rusty Harold, 05/11/2003
-
Re: [XOM-interest] Possible ArrayList optimization,
Elliotte Rusty Harold, 05/09/2003
-
Re: [XOM-interest] Possible ArrayList optimization,
Bradley S. Huffman, 05/09/2003
- Re: [XOM-interest] Possible ArrayList optimization, Elliotte Rusty Harold, 05/10/2003
-
Re: [XOM-interest] Possible ArrayList optimization,
Elliotte Rusty Harold, 05/11/2003
-
Re: [XOM-interest] Possible ArrayList optimization,
Bradley S. Huffman, 05/12/2003
- Re: [XOM-interest] Possible ArrayList optimization, Elliotte Rusty Harold, 05/12/2003
-
Re: [XOM-interest] Possible ArrayList optimization,
Bradley S. Huffman, 05/12/2003
-
Re: [XOM-interest] Possible ArrayList optimization,
Janek Bogucki, 05/11/2003
-
Re: [XOM-interest] Possible ArrayList optimization,
Elliotte Rusty Harold, 05/12/2003
-
Re: [XOM-interest] Possible ArrayList optimization,
dirk bergstrom, 05/12/2003
-
Re: [XOM-interest] Possible ArrayList optimization,
Elliotte Rusty Harold, 05/13/2003
- Re: [XOM-interest] Possible ArrayList optimization, Karl Waclawek, 05/13/2003
-
Re: [XOM-interest] Possible ArrayList optimization,
Elliotte Rusty Harold, 05/13/2003
-
Re: [XOM-interest] Possible ArrayList optimization,
dirk bergstrom, 05/12/2003
-
Re: [XOM-interest] Possible ArrayList optimization,
Elliotte Rusty Harold, 05/12/2003
- RE: [XOM-interest] Possible ArrayList optimization, New, Cecil (GEAE), 05/13/2003
-
Re: [XOM-interest] Possible ArrayList optimization,
dirk bergstrom, 05/09/2003
Archive powered by MHonArc 2.6.24.