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: Mike Colbert <mbcolbert AT yahoo.com>
  • To: Mike Colbert <mbcolbert AT yahoo.com>, Elliotte Harold <elharo AT metalab.unc.edu>
  • Cc: John Cowan <cowan AT ccil.org>, xom-interest AT lists.ibiblio.org
  • Subject: Re: [XOM-interest] XOM and Large Files
  • Date: Wed, 26 Jul 2006 09:54:27 -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.
>
> I also dropped the String, and used the SequenceInputStream to write in the
> root element, and this is of course a superior approach. Although, the time
> savings aren't as noticeable; I would have to do a micro-benchmark and we
> all
> know how that goes, so I won't even bother.
>
> In any case, it's flying now. Many thanks to all!
>
> Mike

In case you're scratching your head over that, I should say that I wrapped the
StringReader in a BufferedReader, per John's advice, and that made it an order
of magnitude faster. (I also wrapped some other Readers elsewhere in the
code,
but that's not important right now.)

Then, I eliminated the String (and the StringReader and its BufferedReader,
altogether) and passed in a SequenceInputStream to XOM, instead. This was
also
an order of magnitude faster, and perhaps even a little faster than that. I
hope that's more clear. Now, I have a deadline to exceed ...

Thanks,
Mike







Archive powered by MHonArc 2.6.24.

Top of Page