commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alex Chaffee / Purple Technology <>
Subject [lang] [collections] Primitive collections (was Entities and LGPL)
Date Thu, 05 Jun 2003 00:55:48 GMT
I heard back from Justin Couch of about the IntHashMap
implementation I used to speed up Entities.  He's willing to rerelease
it under an Apache license so I'll be checking that in (as a
non-public member of [lang]) soon.

He's also graciously offered to donate all his other utility code,
including some primitive-based collections classes.  I think it might
make a good addition to commons.  Does anyone working on [collections]
want to take a look at the classes referenced below?  Or barring that,
would anyone mind if I try incorporating some of them into the
collections code base?  (Of course, any work from me would have to
wait until I rejoin the leisure class...)

 - A

----- Forwarded message from Justin Couch <> -----

Delivered-To: guru@localhost
Date: Wed, 04 Jun 2003 15:49:33 -0700
From: Justin Couch <>
Organization: The Virtual Light Company
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.4) Gecko/20030529
X-Accept-Language: en-us, en
To: Alex Chaffee / Purple Technology <>
Subject: Re: IntHashMap source code
In-Reply-To: <>

G'day Alex,

> I don't think this would entail any effort on your part other than a
> "make it so;" I can just paste in the Apache license and check it in
> on my own (with appropriate credit in the JavaDoc and source).

<voice type="Captain Picard">Make It So</voice>


Sure I'm quite happy to have code reused wherever possible. IntHashMap 
is much simpler than most HashMap implementations and is missing some of 
the more complex methods, but it seems to fit the bill for you nicely. 
The reason I wrote it was for pretty much the same reason that you 
needed it - lots of high-speed string parsing/tokenisation.

We actually found that a lot of the garbage/time was not inside the 
Integer creation, but the actually hash lookups. If you have a dig 
inside the source code of the Sun utils, you'll see that any time you do 
a get() or containsKey() it creates a new instance of the Entry inner 
class object. In the end, we found that we didn't need 80% of the 
functionality of the java.util classes, so wrote specific ones for our 
use that were optimised for performance over features or thread-safeness.

Note that java.util.HashSet is exactly the same with the amount of 
garbage it generates on contains() calls as the HashMap. I can't 
remember if I have that in the codebase or if it's only in the 
Xj3D codebase. If you'd like to grab that as well, you'll find some good 
performance benefits there too. If it's not in the code, let me 
know and I'll send you a copy from Xj3D (which we also maintain/develop).

There's plenty of other code in the org.j3d.util package that may be of 
use to you too. Feel free to acquire anything out of there that you 
need. Xj3D is the far bigger of the two codebases (~350K LoC). Here's an 
almost complete listing of the utils directory there. Let me know if 
there's anything of use for you.


Justin Couch               
Java Architect & Bit Twiddler    
Author, Java 3D FAQ Maintainer        
"Humanism is dead. Animals think, feel; so do machines now.
Neither man nor woman is the measure of all things. Every organism
processes data according to its domain, its environment; you, with
all your brains, would be useless in a mouse's universe..."
                                               - Greg Bear, Slant

----- End forwarded message -----

Alex Chaffee                     
Purple Technology - Code and Consulting
jGuru - Java News and FAQs       
Gamelan - the Original Java site 
Stinky - Art and Angst           

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message