aspose file tools
The moose likes Performance and the fly likes HashTable Issue.... Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » Performance
Reply Bookmark "HashTable Issue...." Watch "HashTable Issue...." New topic
Author

HashTable Issue....

senthil nathan
Greenhorn

Joined: Jun 14, 2002
Posts: 17
Hi,
I have taken a new project which has its framework already done, it uses hashtable extensively...my guess is it will affect performance...if someone can give me the clear explanation of how it will affect and if i can see some material regarding this it will be useful for me to proceed from there on...
As testing is scheduled in a month or so before that i can clean it up..to support my argument i need this..
Thanks.
Senthil
Mark Herschberg
Sheriff

Joined: Dec 04, 2000
Posts: 6035
Originally posted by senthil nathan:
I have taken a new project which has its framework already done, it uses hashtable extensively...my guess is it will affect performance...

Well of course, hashtables will affect performance very much... as will Strings, Vectors, ints, classes, JDBC connections, etc. I assume you want to know how it will affect performance. :-)
Hashtables have the property of being O(1) for insertion and retrieval. This generally makes them quick. The drawbacks are 1) you can't easily sort them using the hashtable itself, and 2) that even though it's O(1), it uses a fairly expensive formula in many cases.
You'll have to either check with your JRE provider, or run your own tests to determine how fast the particular implamentation is.
--Mark
Jamie Robertson
Ranch Hand

Joined: Jul 09, 2001
Posts: 1879

Just a note that HashTable is being phased out of the jdk as is Vector.
"Completeness requires that we mention Hashtable. As with Vector and ArrayList, if you need synchronization, a Hashtable will be slightly faster than a HashMap synchronized with Collections.synchronizedMap. Again, Hashtable has loads of legacy operations, so be extra careful always to manipulate it with the Map interface, or you'll be stuck with it for life. "
from The Java Tutorial - Trail: Collections
David Weitzman
Ranch Hand

Joined: Jul 27, 2001
Posts: 1365
If you're using Java 1.4, Hashtable seems to be faster than HashMap, oddly enough. I still haven't heard from Sun about the bug report I filed though.
 
 
subject: HashTable Issue....
 
Threads others viewed
Hashtable with Vectors or HashMap with ArrayLists - please help
Thread safe spring application
Hashtable allowing null values
How to get values in hashtable
HashTable : initial capacity and load factor
developer file tools