It's not just a serialization issue. The data model is different; a tree consisting of a root element owning lots of row elements owning lots of cell elements each of which contains a text node which is the string representation of a number is not the same as a two-dimensional array of numbers.
Michael Kay Saxonica On 3 Feb 2014, at 10:16, jean-marc Mercier <[email protected]> wrote: > Michael, you're right, and I do now understand that an efficient > serialization / deserialization of a matrix structure could be more > straightforward using JSON than XML. > However, without considering this potential overhead due to serializing / > deserializing procedure, that should be or order "epsilon" comparing to > linear algebra algorithms complexity, once loaded into memory, I don't think > that a XQUERY coded matrix algorithm will be more efficient using XML or JSON > as serialization choice. > > Am I right ? > > > 2014-02-02 Michael Kay <[email protected]>: > > On 2 Feb 2014, at 20:33, jean-marc Mercier <[email protected]> wrote: > > > N-dimensional representation of arrays are quite straightforward with XML > > too. Is there any incentive to expect better performances with a JSON > > matrix representation rather than an XML one ? > > > > I think that if you had an XML schema for an XML representation of > N-dimensional arrays, and if the XPath processor recognized that schema and > used a custom tree representation for its instances, then arrays could be > represented using XML just as efficiently as using JSONiq arrays. But if you > use a general tree representation that allow any element names, namespaces, > base URIs, mixed content, attributes, and all the other paraphernalia of XML, > then it is likely to be significantly less efficient. > > For example: > > * XML is text-oriented, and using XML for numeric values invariably involves > string-to-number conversion, which is expensive > > * Numeric subscripts when addressing XML (as in para[3]) are likely to have > O(n) performance rather than constant performance, because the tree structure > is likely to be optimized for scanning all the children rather than locating > an individual child by its index. > > Michael Kay > Saxonica > >
_______________________________________________ [email protected] http://x-query.com/mailman/listinfo/talk
