Win a copy of Microservices Testing (Live Project) this week in the Spring forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Liutauras Vilda
  • Henry Wong
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Al Hobbs
  • Carey Brown
Bartenders:
  • Piet Souris
  • Mikalai Zaikin
  • Himai Minh

HashTable Issue....

 
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Author
Posts: 6055
8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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
 
Ranch Hand
Posts: 1879
MySQL Database Suse
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 1365
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
reply
    Bookmark Topic Watch Topic
  • New Topic