[jdom-interest] Re: efficient Java collections

Joseph Bowbeer jozart at csi.com
Sat Mar 9 00:09:01 PST 2002


Jason Baldridge writes:

> It shouldn't be too difficult to do, [...] -- just swapping
> in more efficient collection implementations!


And then benchmark the results to verify that significantly better
performance and/or memory savings are actually achieved...


Based on my quick inspection, however, I don't believe trove is a good
match.

1. Most of the optimizations are aimed at homogeneous collections of
int/long/float, etc., which won't help JDom.

2. Concerning the TLinkedList implementation, only instances of TLinkable
can be added to the list.  Ouch.

3. Also, won't the LGPL license be a problem for a JCP-sanctioned reference
implementation?


By the way, there's a small repository of Collections implementations at:

  http://javacollections.org/


--- original message ---

From: Jason Baldridge <jmb at cogsci.ed.ac.uk>
Date: Fri, 8 Mar 2002 11:25:10 +0000 (GMT)
To: jdom-interest at jdom.org
Reply-To: Jason Baldridge  <jmb at cogsci.ed.ac.uk>
Subject: [jdom-interest] efficient Java collections

Hi all,

I'm passing this correspondence with Jason Hunter along to the JDOM
interest group regarding using the trove collections
(http://trove4j.sf.net) in JDOM.  It shouldn't be too difficult to do,
so it could be a nice task for someone who wanted to play with the
code but not worry about making any fundamental changes -- just
swapping in more efficient collection implementations!

Jason

Jason Hunter writes:
 > Interesting.  We stopped using LinkedList after b7 actually (ArrayList
 > was much better in all respects despite what we initially thought), but
 > this is an interesting library.  I'd suggest you post about it to
 > jdom-interest and see if anyone wants to give it a test whirl.  I myself
 > am too swamped to do it, but someone on the list might like
 > experimenting.
 >
 > -jh-
 >
 > Jason Baldridge wrote:
 > >
 > > Jason and Brett,
 > >
 > > Just in case you haven't heard about it yet, there is a project
 > > (trove4j) on sourceforge for efficient Java collections, licensed
 > > under the LGPL.  Memory and speed is often significantly improved, and
 > > there is a linked list implementation that actually behaves like a
 > > linked list in terms of performance.  I've seen here and there in JDOM
 > > code that you use linked lists, and the trove lists will use much less
 > > memory and be a good deal faster. There is also support for
 > > collections of primitive types.
 > >
 > > Anyway, you can check it out at http://trove4j.sf.net.  The switchover
 > > to using trove classes is trivial in most cases.  The linked lists
 > > require you to implement the TLinkable interface, which is not tough,
 > > but does require either extending TLinkableAdaptor or implementing a
 > > few methods in every class that you want to use in a TLinkedList.
 > >
 > > I saw that JDOM beta 8 is nearing completion --- looking forward to
 > > it!  Thanks for creating JDOM, it's been a real help in my work.
 > >
 > > Cheers,
 > > Jason Baldridge
 >






More information about the jdom-interest mailing list