R
Rob Baxter
I have a situation where I will need to load a large number
(potentially several thousand) of relatively small objects into an in
memory collection. Once the objects are initially loaded the
collection can assumed to be static (ie no more objects will be
added/removed).
This collection will be used to lookup objects based on a few string
and integer attributes. My primary concern here is to optimize to
speed of the lookups as much as possible as i will potentially have to
do several hundred lookups per second. Given this criteria, can anyone
suggest the optimal container framework I should use to store the
objects?
I am considering using an Array to store the objects and then
implementing the java.util.Comparator interface for the objects and
passing that to the Array.sort to presort them. Then using the
Array.binarySearch (and the Comparator again) method to perform the
lookup.
How would this approach compare performance with a hash table or some
other collection? Any advice or recomendations would be greatly
appreciated. TIA,
</rob>
(potentially several thousand) of relatively small objects into an in
memory collection. Once the objects are initially loaded the
collection can assumed to be static (ie no more objects will be
added/removed).
This collection will be used to lookup objects based on a few string
and integer attributes. My primary concern here is to optimize to
speed of the lookups as much as possible as i will potentially have to
do several hundred lookups per second. Given this criteria, can anyone
suggest the optimal container framework I should use to store the
objects?
I am considering using an Array to store the objects and then
implementing the java.util.Comparator interface for the objects and
passing that to the Array.sort to presort them. Then using the
Array.binarySearch (and the Comparator again) method to perform the
lookup.
How would this approach compare performance with a hash table or some
other collection? Any advice or recomendations would be greatly
appreciated. TIA,
</rob>