• 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
  • Ron McLeod
  • Rob Spoor
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Henry Wong
  • Liutauras Vilda
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Tim Holloway
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Mikalai Zaikin
  • Piet Souris

which gives better performance - Properties or HashTable ??

 
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi,
i am building an information repository ..i have to options to choose from :
making a pproperties file and keeping info in it ??
or use
HashTable

my question is which givews better performance ??
thanx
Anand
 
Author
Posts: 6055
8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It depends how you use the properties file. Generally, file access is slow. What you would want to do is read the properties file into memory when the program begins, and reference the values in memory. If you have a method lookup which is faster than a hashlookup, you'd save time vs a hashtable (e.g. store values in an array, and use known property types as public static final ints used to reference into the arrau).
JDK 1.2 and above include java.util.Properties which extends java.util.Hashtable. It acts like a hashtable, but with convience methods for writing and writing properties to and from a file. Of course, it is only as fast as a hashtable (with a marginally slower creation time :-)
--Mark
hershey@vaultus.com
 
Oni Anand
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
thanks a lot for explaination
 
Get me the mayor's office! I need to tell her about this tiny ad:
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
reply
    Bookmark Topic Watch Topic
  • New Topic