[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: XML Schema: "Best used with the ______ tool"

  • From: "Michael Kay" <mike@s...>
  • To: "'Boris Kolpackov'" <boris@c...>
  • Date: Wed, 3 Dec 2008 22:30:57 -0000

RE:  XML Schema: "Best used with the ______ tool"

Running this from the Saxon command line, with the query as written, I get
the following results:

Query compile time: 161ms

Document parsing/build time: 125ms

Query execution time (average over 100 queries):
  age=1, gender=male: 12.5ms
  age=100, gender=male: 34.9ms

I wasn't sure what query parameters you were using.

The difference between the two queries is of course the volume of result
data; in my test I was serializing the results to a file rather than
consuming them in a Java application. But I did include the string
concatenation. Sending the results to a null destination (to show the impact
of the serialization cost) reduces the latter cost to 25.1ms.

Removing the string concatenation and just returning the nodes (without
serialization) reduces the query times to 12.3ms and 17.7ms respectively.

This is Saxon-B 9.1.0.3. Normally this kind of query would run significantly
faster in Saxon-SA, which would take advantage of indexing. However, this
example query is on fields (age and gender) that have so few distinct values
they seem deliberately chosen to make indexing ineffective. Also, this kind
of query would often benefit from document projection, but because the data
in the file is so artificially minimal, projection yields no benefits.

I haven't tried making the query schema-aware, but I did try modifying it to
do an integer comparison on age ($x/xs:integer(@age) < $age) and this
reduces the execution times marginally, to 12.0ms and 17.2ms respectively.

Now, it's not clear to me here what I'm comparing with. You reported a
figure of 0.09s for the data binding test: I assume that is 100 executions
of the query (with what parameters, though?) and excludes the XML
parsing/marshalling cost? What I would actually expect is that for both
technologies, the parsing cost (125ms in my case) is dominant in many
real-world situations. If the query execution cost turns out to be 12ms for
XQuery vs 0.9ms for data binding, then I think very few applications are
going to notice the difference. (Remember, I never said it would be faster:
I was challenging Dennis's assertion that XQuery performance was not good
enough to meet the user requirement.)

My machine is a Toshiba Tecra laptop, Intel Core 2 Duo, 2.40GHz running
Windows Vista; I used JDK 1.6.0_07 with the JDK-supplied Xerces parser.

Michael Kay
http://www.saxonica.com/ 


> While I would also like to see the results of comparing XSLT 
> to data binding as agreed between you and Dennis, I came up 
> with a simple Binding/XQuery benchmark for the above scenario 
> (repetitive access to most of the data in a document). It 
> compares the speed of performing the same operation using one 
> implementation of XML data binding (CodeSynthesis XSD[1]) and 
> one implementation of XQuery (XQilla[2]). The source code, 
> including the schema and sample XML document is available here:
> 
> http://www.codesynthesis.com/~boris/tmp/dbxq.tar.gz
> 
> The benchmark operates on the following XML:
> 
> <t:people xmlns:t='http://www.example.com/test'>
>   <description>People catalog.</description>
>   <person first="John" last="Doe" age="30" gender="male"/>
>   <person first="Jane" middle="Q" last="Doe" age="28" 
> gender="female"/>
> 
>   ...
> 
> <t:people>
> 
> The operation performed selects all the person records from 
> the catalog that are of a specific gender and younger than a 
> specific age. The input parameters (gender and max age) are 
> determined at runtime. The output is first name, last name, 
> and age for each matching record, expected as native types 
> (string, string, and unsigned short). If you need a concrete 
> example, think of it as a GUI or server application where the 
> user or client can specify gender and max age (in GUI or as a 
> non-XML request) and get the list of records back (again, in 
> GUI or as a non-XML response).
> 



[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]


PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
 

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.


Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.