You are viewing a plain text version of this content. The canonical link for it is here.
Posted to soap-dev@ws.apache.org by WJCarpenter <bi...@carpenter.ORG> on 2004/02/13 23:31:21 UTC

SAXSource vs DocumentBuilder performance

Some time back, post-2.3.1, this change was made to Apache SOAP:

      Add the ability to select between parsing XML using a
      DocumentBuilder versus a Transform from a SAXSource to a
      DOMResult on a per-Call basis.  This is on the client only.
      If testing establishes that the Transform offers a significant
      speed improvement, the server code may be changed as well.

I sort of recollect that there was a difference of opinion about
whether this actually made any difference or not.  Before I go off and
construct some tests to measure it, has anyone else already done so?
-- 
bill@carpenter.ORG (WJCarpenter)    PGP 0x91865119
38 95 1B 69 C9 C6 3D 25    73 46 32 04 69 D6 ED F3


Re: SAXSource vs DocumentBuilder performance

Posted by WJCarpenter <bi...@carpenter.ORG>.
sn> My tests comparing the two methods showed no net difference.  Each
sn> method would slightly better the other in some tests, but in no
sn> test was either better by more than 10%, if I recall.

After originally posting the question today, I did run a short series
of tests (that I already had laying around) where that was all I
changed.  For typical SOAP stuff, by which I mean lost of relatively
small XML nodes, both modes scale pretty linearly.  The SAXSource
stuff mostly beat the DocumentBuilder stuff, but it was consistent
with your findings and was only a few percent better.

One aspect of the results surprised me. 

Some of the test cases I ran had only a half dozen or so XML nodes in
the response, but one of those was a String parameter.  It's actually
a CDATA block containing a non-SOAP blob of XML.  The times for those
test degraded much faster than linear with SAXSource.  By the time I
got up to a payload size of a couple megabytes, it was running 25 time
slower than DocumentBuilder for the same data (that's 25 times, not
25%).

I didn't have any time to look into, but I obviously suspect some
pretty inefficient String handling somewhere.  (The XML parser was
Xerces 2.4.)
-- 
bill@carpenter.ORG (WJCarpenter)    PGP 0x91865119
38 95 1B 69 C9 C6 3D 25    73 46 32 04 69 D6 ED F3


Re: SAXSource vs DocumentBuilder performance

Posted by Scott Nichol <sn...@scottnichol.com>.
My tests comparing the two methods showed no net difference.  Each method would slightly better the other in some tests, but in no test was either better by more than 10%, if I recall.

Scott Nichol

Do not send e-mail directly to this e-mail address,
because it is filtered to accept only mail from
specific mail lists.
----- Original Message ----- 
From: "WJCarpenter" <bi...@carpenter.ORG>
To: <so...@ws.apache.org>
Sent: Friday, February 13, 2004 5:31 PM
Subject: SAXSource vs DocumentBuilder performance


Some time back, post-2.3.1, this change was made to Apache SOAP:

      Add the ability to select between parsing XML using a
      DocumentBuilder versus a Transform from a SAXSource to a
      DOMResult on a per-Call basis.  This is on the client only.
      If testing establishes that the Transform offers a significant
      speed improvement, the server code may be changed as well.

I sort of recollect that there was a difference of opinion about
whether this actually made any difference or not.  Before I go off and
construct some tests to measure it, has anyone else already done so?
-- 
bill@carpenter.ORG (WJCarpenter)    PGP 0x91865119
38 95 1B 69 C9 C6 3D 25    73 46 32 04 69 D6 ED F3