Agree with Alek that APIs and implementation are two different things. It is
much easier to compare implementations (look at http://xpb4j.sf.net for a
benhcmark program and
http://www.pankaj-k.net/xpb4j/docs/Measurements-May30/measurements-May30-200
2.html for some measured results ). If you are really keen, you could run
the program under a profiler and see where a particular implementation is
spending more time.

Having said that, I must add that the structure of pull parser API allows an
implementation to minimize creation of new objects (compoared to SAX and DOM
APIs) and this could be a reason why most pull parser API implementations
are faster than SAX implementations.

/Pankaj.

> -----Original Message-----
> From: Aleksander Slominski [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, February 20, 2003 6:10 PM
> To: [EMAIL PROTECTED]
> Subject: Re: Why Pull-Parser faster ? - Still NO answer
> 
> 
> Ricky Ho wrote:
> 
> > Just between SAX and XPP ....
> >
> > If SAX can be stopped anytime by throwing an exception, 
> this means the 
> > application can control when to stop.  And if XPP is not skipping 
> > whitespace ...
> >
> > Why XPP is faster than SAX ?? 
> 
> hi,
> 
> not sure if these two can be compared. SAX is just an API with many 
> implementations. XPP2 is also API (with two implementations) 
> and XmlPull 
> API has 3 implementations (and XPP3 is one of them). even if you run 
> some tests (like 
> http://www.extreme.indiana.edu/~aslom/xpp_sax2bench/results.ht
ml) how it 
will work for you will ultimately depend on implementation used, 
hardware and software environment (OS, memory, CPU, version of Java), 
your application and on what XML input you are processing.

however i guess your question is if there is something in XML push or 
pull parsing (SAX or XmlPull  are just examples of such APIs) that would 
make one faster than another? i think that both APIs have similar 
performance capabilities and choice to use push or pull parsing should 
be dictated by you need to use streaming parsing (if you do not want 
streaming than maybe some DOM-like API is better) and how your 
application is processing XML.

i would say that for if you need to do filtering and/or use state 
machines then push parsing code is easier and when you need to convert 
XML to other representation pull parsing code is more natural IMHO - i 
have discussed some of those issues and some others in this technical 
report: http://www.extreme.indiana.edu/xgws/papers/xml_push_pull/  where 
i makes point that  pull and push are actually complementary approaches 
and can be used *together* even on the same input (it describes XPP2 API 
but most of it applies to XmlPull API as well).

hope you find it useful in addressing your concerns.

thanks,

alek

-- 
"Mr. Pauli, we in the audience are all agreed that your theory is crazy. 
What divides us is whether it is crazy enough to be true." Niels H. D. Bohr

Reply via email to