[jdom-interest] XMLOutputter patch

Bradley S. Huffman hip at a.cs.okstate.edu
Tue Nov 27 18:27:32 PST 2001


Alex Rosen writes:

> Note however that StringBuffer->String is much cheaper than String->char[]
> or char[]->String:

Not if you do it 5-6 times on the same text, as opposed to once.
Or do things like StringBuffer->String->Writer which takes the string
a Goes String->char[].

> Interesting idea. Seems a little counter-intuitive to me, though. Also, not
> sure how it would help - each filter would still have to do a copy, right?

A copy of what? The whole String, no.  String.charAt(i) is about as fast
as ch[i], so for each char in a String

                          -> ignore char
         char -> test it /
                          -> send char to Writer

With the only penalty being keeping the previous char and testing it.

Give me a few days (it works now, I just want to test it a little more).
As I said, after some tests it may just be a candidate for the bit-bucket.

Brad



More information about the jdom-interest mailing list