Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Fast Hashtable in Java

I'm creating a chess program that utilizes a hash table of previously evaluated positions to (hopefully) reduce search time. Only problem is I'm using an ArrayList to store the hash values and the lookup time increases based on how many positions i've stored. How can I get a hash table which has a lookup time independent of it's current size? (Forgive me, I'm kinda a noob at java, objective c is really my thing)

Edit: If it matters, I'm using the Zobrist fast hashing technique. Based on some trials, I've determined that it is NOT the generation of the hash keys that takes up the large amount of time. The hashing methods is very fast and its effect on the speed is almost unnoticeable.

like image 853
Christian Daley Avatar asked Dec 20 '22 11:12

Christian Daley


1 Answers

The standard Java HashMap is pretty good and already available to you, but if you want the screamingly fastest map in Java use Trove ( http://trove4j.sourceforge.net/html/overview.html ) which is filled with data structures that are optimized for performance.

like image 168
Tom Carchrae Avatar answered Dec 23 '22 00:12

Tom Carchrae