commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Tatu Vanhanen" <tatu.vanha...@graftor.fi>
Subject RE: [primitives] Looking for a primitive hashtable
Date Thu, 01 Apr 2004 08:00:21 GMT

> -----Original Message-----
> From: Alex Karasulu [mailto:aok123@bellsouth.net]
...
> Now the arrays would look like so after these operations are performed:
>
>   Keys    Indices   Object Values
>  ------    -----       -----
>  |    |    |   |       | +-|-----> "Cat"
>  ------    -----       -----
>  |2048|    | 3 |       | +-|-----> "Dog"
>  ------    -----       -----
>  | 94 |    | 2 |       |   |       a hole (null)
>  ------    -----       -----
>  | 23 |    | 0 |       | +-|-----> "Rat"
>  ------    -----       -----
>

This is exactly what I was thinking of. In addition, I was considering the
"Keys" to be always sorted, so a binary search (with e.g.
java.util.Arrays.binarySearch) could be used to lookup the actual index to
the Object array.

But more questions raise:
1. How much more time it takes to sort after every modification (compared to
standard HashMap modification)?
2. How much time does the lookup take (compared to standard HashMap lookup)?

Some hashing needed additionally (don't know anything about that)?

I was thinking of doing some tests to investigate the actual advantage of
something like this, but I don't know when I have time.

And as I mentioned, there are LGPL:ed solutions available (should be tested,
too), but if this kind of stuff is really more efficient and fast than using
standard Map:s then it would be good to find that in e.g.
commons-primitives.

I don't need an int-keyed-map now, but probably would some day.

- Tatu V.


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Mime
View raw message