Sharing structured data

XML Magazine

Subscribe to XML Magazine: eMailAlertsEmail Alerts newslettersWeekly Newsletters
Get XML Magazine: homepageHomepage mobileMobile rssRSS facebookFacebook twitterTwitter linkedinLinkedIn


XML Authors: Jason Bloomberg, Jayaram Krishnaswamy, Chris Pollach, Peter Silva, Mehdi Daoudi

Related Topics: XML Magazine

RSS Feed Item

Re: Data-binding versus XQuery performance

Hi Michael,

Michael Kay <[email protected]> writes:

> First, I implemented the data binding approach using the reference
> implementation of JAXB.

It is not quite correct to compare a reference implementation to a 
commercial product.


> Then I looked at the cost of executing the query originally proposed by
> Boris: find persons whose age is less than X and whose gender is male, over
> a variety of age values (I used a linear distribution between 1 and 100).
> The average execution time was:
> 
>   JAXB                         0.42ms
>   Saxon-B (untyped)            9.43ms
>   Saxon-SA (typed)             6.85ms
>
> [...] 
>
> This time I measured the cost of doing the query, serializing it to HTML,
> and writing the results to a file:
> 
>   JAXB                       42.1ms
>   Saxon-B                   676.0ms
>   Saxon-SA                    7.5ms


The JAXB numbers look highly suspicious. Both the no-output and HTML
output queries do a single pass over the object model. The HTML output
test just adds the number increment and simple HTML formatting at the
end. And this resulted in a 100 times slowdown?

I also implemented this test with CodeSynthesis XSD (event-driven 
C++/Parser mapping). The test measures both XML parsing, query
execution, and HTML output to a file. Here are the numbers (I've
added the XML parsing and query times for JAXB and Saxon):

XSD without validation                25.9ms
XSD with validation                   27.9ms
JAXB                                 111.1ms
Saxon-B  without validation/untyped  751.0ms
Saxon-SA with validation/typed       199.5ms


> Those who said that declarative query languages for database access would
> never offer adequate performance were proved wrong by the end of the 1980s.
> It surprises me that 20 years later people don't recognize that the same
> applies to XML access.

Adequate performance means different things to different applications.
For some 7 times slower may not mean adequate.


Boris

-- 
Boris Kolpackov, Code Synthesis Tools   http://codesynthesis.com/~boris/blog
Open source XML data binding for C++:   http://codesynthesis.com/products/xsd
Mobile/embedded validating XML parsing: http://codesynthesis.com/products/xsde

Read the original blog entry...