Re: Any update on telcon times?

* 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 UTC