W3C home > Mailing lists > Public > public-webapi@w3.org > April 2006

Re: Any update on telcon times?

From: Bjoern Hoehrmann <derhoermi@gmx.net>
Date: Mon, 24 Apr 2006 16:56:11 +0200
To: Jonas Sicking <jonas@sicking.cc>
Cc: Web APIs WG <public-webapi@w3.org>
Message-ID: <mump42pimjil12aeb9q3tdvs38sv1g2a5m@hive.bjoern.hoehrmann.de>

* Jonas Sicking wrote:
>> I personally think ElementTraversal should be replaced by a
>> .selectSingleNode() method that supports a small XPath subset,
>
>There is a gigantic difference in performance between selectSingleNode 
>and firstElementChild. Just parsing alone will take longer time then 
>just iterating the children and finding the first element.

ElementTraversal in SVG Tiny 1.2 replaces the node traversal methods in
DOM Core, so as to allow implementations to not store the other node
types, white space text nodes in particular. The only overhead added by
using selectSingleNode instead is that you have to do some string
comparison to branch to the correct traversal code, there isn't any more
parsing or XPath code necessary than that.

What the best solution is naturally depends on what you are trying to
achieve; if you don't care much about ever more traversal methods, and
really do need the performance gains, ElementTraversal might be a good
idea. It isn't clear to me though that this should be the primary con-
cern.

>>   .previousElementSibling -> .selectSingleNode('previous-sibling::*')
>
>This will probably not work, unless we create a very complex definition 
>of how selectSingleNode works. Usually the result of an XPath evaluation 
>is sorted in document order, so this would actually select 
>.parentNode.firstElementChild.

It's also not called previous-sibling, it is preceding-sibling::*[1].
-- 
Björn Höhrmann · mailto:bjoern@hoehrmann.de · http://bjoern.hoehrmann.de
Weinh. Str. 22 · Telefon: +49(0)621/4309674 · http://www.bjoernsworld.de
68309 Mannheim · PGP Pub. KeyID: 0xA4357E78 · http://www.websitedev.de/ 
Received on Monday, 24 April 2006 14:56:25 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 8 January 2008 14:18:54 GMT