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

Reply via email to