Skip to Content.
Sympa Menu

xom-interest - Re: [XOM-interest] XOM and Large Files

xom-interest AT lists.ibiblio.org

Subject: XOM API for Processing XML with Java

List archive

Chronological Thread  
  • From: Tatu Saloranta <cowtowncoder AT yahoo.com>
  • To: xom-interest AT lists.ibiblio.org
  • Subject: Re: [XOM-interest] XOM and Large Files
  • Date: Wed, 26 Jul 2006 11:31:56 -0700 (PDT)

--- Mike Colbert <mbcolbert AT yahoo.com> wrote:

> --- Elliotte Harold <elharo AT metalab.unc.edu> wrote:
>
> > In that case use a SequenceInputStream to add the
> root element start and
> > end-tags before you read in the data. You really
> don't want to read
> > everything into a String first.
>
> Excellent advice!
>
> So, it turns out I had neglected to wrap my Readers
> in BufferedReaders, as John
> advised. They were in there before, but I changed
> things around and they fell
> out somewhere along the way. So many, many thanks
> to John for reminding me.
> This alone made an order of magnitude speed
> improvement.

Actually, while this can make a positive difference
with Readers, it is generally counter-productive to
wrap InputStreams in BufferedInputStreams, if those
streams are directly passed to XML parsers (which is
the right way -- it's better to let parse detect the
encoding used). Reason is that most (all?) parsers I
know of buffer their input, so adding
BufferedInputStream just adds one unnecessary memory
copy operation to the chain. In grand scheme of
things, this is not a big deal, but just thought I'll
mention it. ;-)
So passing just that FileInputStream (or sequenced
version of the same, or, like Michael suggested,
wrapper doc) is usually the best thing to do.

-+ Tatu +-


__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com




Archive powered by MHonArc 2.6.24.

Top of Page