Matthias Reuter wrote: >> Let's talk real numbers here. > >> http://jsperf.com/xpath-vs-dom > > I don't know if I understand the XPath correctly, but it seems to me, that > the three examples don't do the same (actually, they do in the given > example, but not in general.
You're right. They don't do the same thing, and should be fixed. Your fixes look good. The main point, though, was to find a way to target the H3 in the grandparent element of the current element, which I believe the versions shown do. > In my opinion, when comparing the speed, we need to make sure they > compared ways behave the same. You're probably right, but the main points I was making were that any of these is fast enough for most use cases, and, as you said, > So I added a second version of your test: http://jsperf.com/xpath-vs-dom/2 > Still shows: Native DOM traversal is much faster than anything else. -- Scott -- To view archived discussions from the original JSMentors Mailman list: http://www.mail-archive.com/[email protected]/ To search via a non-Google archive, visit here: http://www.mail-archive.com/[email protected]/ To unsubscribe from this group, send email to [email protected]
