xom-interest AT lists.ibiblio.org
Subject: XOM API for Processing XML with Java
List archive
RE: [XOM-interest] Possible ArrayList optimization
- From: "New, Cecil (GEAE)" <cecil.new AT ae.ge.com>
- To: "'dirk bergstrom'" <dirk AT juniper.net>, "'XOM-interest AT lists.ibiblio.org'" <XOM-interest AT lists.ibiblio.org>
- Cc:
- Subject: RE: [XOM-interest] Possible ArrayList optimization
- Date: Tue, 13 May 2003 16:25:55 -0400
I don't think anyone has suggested a heuristic approach (perhaps because it
is a
bad idea!). You could keep track of the average size and adjust as you go
along.
-----Original Message-----
From: dirk bergstrom [mailto:dirk AT juniper.net]
Sent: Monday, May 12, 2003 10:52 PM
To: Elliotte Rusty Harold
Cc: xom-interest
Subject: Re: [XOM-interest] Possible ArrayList optimization
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
_______________________________________________
XOM-interest mailing list
XOM-interest AT lists.ibiblio.org
http://lists.ibiblio.org/mailman/listinfo/xom-interest
-
Re: [XOM-interest] Possible ArrayList optimization
, (continued)
-
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,
Bradley S. Huffman, 05/09/2003
Archive powered by MHonArc 2.6.24.