• 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
  • Liutauras Vilda
  • Paul Clapham
Sheriffs:
  • paul wheaton
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Piet Souris
Bartenders:
  • Mike London

XML Parsers to use object pooling

 
Ranch Hand
Posts: 188
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Dear people,
I'm a newbie in this forum.
Somebody suggested that the XML parser used in our project should be 'object pooled'. I understand object pooling. In fact, I've used commons-pooling by Jakarta before. But, I don't quite understand how a parser instantiation would cause memmory consumption/performance issue. Wouldn't it best be in some kinda Singleton?
Any hints would be appreciated. Thanks.
 
Jes Sie
Ranch Hand
Posts: 188
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hellou, anyone out there please comment....
 
Wanderer
Posts: 18671
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The problem with a singleton here is if you ever have more than one thread trying to use the parser. A single parser really can't be used this way - so you'd need either a new parser for each thread, or an object pool. (Or you can use synchronization to ensure that only one thread uses the parser at a time - but that's slower.) If you're doing a lot of parsing, and/or if the parsers are fairly large, complex objects (which they often are) then the object pool may be best in the long run. As usual though, it's best if you perform some profiling first to see if parser instantiation and GC is really a big contributor to current memory/performance problems (if there are any). If it ain't broke, don't fix it.
[ December 05, 2002: Message edited by: Jim Yingst ]
 
reply
    Bookmark Topic Watch Topic
  • New Topic