xom-interest AT lists.ibiblio.org
Subject: XOM API for Processing XML with Java
List archive
- From: Wolfgang Hoschek <whoschek AT lbl.gov>
- To: Elliotte Harold <elharo AT metalab.unc.edu>
- Cc: xom-interest AT lists.ibiblio.org
- Subject: Re: [XOM-interest] Serializer performance patches
- Date: Wed, 29 Jun 2005 08:48:07 -0700
On Jun 29, 2005, at 4:29 AM, Elliotte Harold wrote:
Wolfgang Hoschek wrote:
private static final boolean mightNeedAttributeEscaping(String s) { // WH
Why "might"? Is there any case in which this method would return true and attribute escaping would not be needed?
because adjustingWhiteSpace() might be false. See writeAttributeValue (char c)
Also I'm guessing a lot of the speedup comes from writing the data as one string, rather than a character at a time.
Right.
However this approach still needs to loop through the whole string if it's going down the fast path. It can short circuit but the result of that is going down the slow path instead. What if in this loop we simply built up a new StringBuffer containing the escaped string and then wrote that? Could that be faster for both cases? Or would the extra time spent in building the StringBuffer kill any advantages?
Checking each char in the string appears to be cheap IFF the loop is very tight and there's very little code in it, probably because of much more efficient inlining, unrolling, and other optimizations. The large complicated body with virtual calls of the slow non-Unicode methods taking care of the general case effectively prevents the compiler from doing a good job.
Wolfgang.
-
[XOM-interest] Serializer performance patches,
Wolfgang Hoschek, 06/29/2005
- Re: [XOM-interest] Serializer performance patches, Elliotte Harold, 06/29/2005
-
Re: [XOM-interest] Serializer performance patches,
Elliotte Harold, 06/29/2005
- Re: [XOM-interest] Serializer performance patches, Wolfgang Hoschek, 06/29/2005
-
Re: [XOM-interest] Serializer performance patches,
Elliotte Harold, 06/29/2005
- Re: [XOM-interest] Serializer performance patches, Wolfgang Hoschek, 06/29/2005
- Re: [XOM-interest] Serializer performance patches, Elliotte Harold, 06/29/2005
-
Re: [XOM-interest] Serializer performance patches,
Elliotte Harold, 06/29/2005
- Re: [XOM-interest] Serializer performance patches, Wolfgang Hoschek, 06/29/2005
- Re: [XOM-interest] Serializer performance patches, Wolfgang Hoschek, 06/29/2005
-
Re: [XOM-interest] Serializer performance patches,
Elliotte Harold, 06/29/2005
-
Re: [XOM-interest] Serializer performance patches,
Wolfgang Hoschek, 06/29/2005
- Re: [XOM-interest] Serializer performance patches, Wolfgang Hoschek, 06/29/2005
- Re: [XOM-interest] Serializer performance patches, Elliotte Harold, 06/29/2005
-
Re: [XOM-interest] Serializer performance patches,
Wolfgang Hoschek, 06/29/2005
Archive powered by MHonArc 2.6.24.