XML.orgXML.org
FOCUS AREAS |XML-DEV |XML.org DAILY NEWSLINK |REGISTRY |RESOURCES |ABOUT
OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]
Re: [xml-dev] XML Schema: "Best used with the ______ tool"

Hi Michael,

Michael Kay <mike@saxonica.com> writes:

> [...] I don't think there's any intrinsic reason why they should 
> be slower than data binding. I'm not saying they are faster, just
> challenging your assertion that they are impossibly slow - I think
> the burden of proof is on you.

On the high level, the primary reason is that with data binding
the operations are performed on the data itself while XSLT, 
XQuery, etc., operate on the XML representation of this data.

On a more technical level, I believe the two primary areas that
contribute to the performance difference are the string-based
flow control (XSTL/XQuery compare strings to access an element
while data binding simply calls an (inline) function) as well
as conversion of data to/from string representation. As an
example, consider the following XML fragment:

<people>
  <person name="John Doe", age="32"/>
  <person name="Jane Doe", age="28"/>

  ...

</people>

Let's say we want to access all people younger than 30. With
data binding we will have something like this:

people p = ...

for (iterator i = p.begin (); i != p.end (); ++i)
{
  if (i->age () < 30) 
  {
    // process
  }
}

The age value is retrieved using a function call and the return
value is of type int, directly comparable to 30.

With XML representation there will be a bunch of string comparisons
to first locate all "person" elements and then to locate the "age"
attribute. We will also need to convert the age value from string
to int in order to compare it.

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


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


News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 1993-2007 XML.org. This site is hosted by OASIS