[jdom-interest] XMLOutputter.isWhiteSpace
Alex Rosen
arosen at silverstream.com
Mon Apr 29 08:10:04 PDT 2002
> Does the isWhitespace method contain any sensitive string encoding in
> the way it uses the 4 whitespace markers and the indexof?
> The indexof method is very speed prohibitive.
> I can do the same thing using char comparisons and it will yeild about
> 10X performance increase. This adds up with big messages. I guess the
> question is how does the 16bit characters react to literals like '\t'
> compared to "\t" Strings. I don't see any gotchas. What does everyone
> else think?
Sounds good to me. There shouldn't be any difference between looking for
'\t' as a char or "\t" in a String. "\t".charAt(0) == '\t'.
> If you want to take a look at escapeElement, there is also some
> improvement if we not add a character every loop, but add chunks of
> data. This probably applies to escapeAttribute.
Also seems like a good idea, though probably less of a difference.
Alex
More information about the jdom-interest
mailing list