• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

which is worse Prop file or XML

 
Ranch Hand
Posts: 52
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Ranchers,
which one out of the following, takes more time :
1. Reading a value from property file
OR
2. Reading from teh XML file ?
 
Ranch Hand
Posts: 1970
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
There are few definite answers in performance. It so often depends on context.

Generally, though, I'd expect properties to be faster than XML. The properties file format is simpler. Parsing it doesn't have as much set-up as parsing XML.

It would rarely be appropriate to base your design decision on this, though. Normally, choosing between properties and XML would depend on what types of system or person were going to be producing and consuming these files. For instance, properties is a Java-specific thing, whereas XML is universal. Also, XML is better at structured (particularly hierarchical) data, while properties is more for flat data.

Why is performance an issue for reading these files? Are you reading lots of them? Are you reading the same file frequently? If the latter, can you use caching?

Finally, your login name is a bit borderline for JavaRanch. We require at least two names (*not* initials) and they must be, or at least sound like, a real name. As it's borderline, that's all I'm saying, but changing your display name to something better would be appreciated. Later: I have been corrected - we do allow initials, though full names remain preferred.
[ July 03, 2007: Message edited by: Peter Chase ]
 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I would agree that performance wise File reading would be better. But file has its limitation like validation etc can not be forced.

I have come across few projects where jaxb can be used to load the xml as java object which can be useful. An xml file can be validated against the xsd and hence provide a better solution
 
reply
    Bookmark Topic Watch Topic
  • New Topic