Categories
AJAX JavaScript

Faster DOM Queries

Dean Edwards has posted a demo with a cross browser way of super quick DOM queries.

Limitations

* As described earlier, speed improvements only apply on page load for IE. Further DOM queries will use the original getElementsBySelector function
* the speed of CSS2 queries (attribute selectors) are not improved for IE5/6
* because of the nature of the CSS hack, you can only apply one behavior per element 🙁

Conclusion

* DOM queries on Firefox seem pretty quick
* XPath is about 150% faster than DOM queries on a Mozilla platform
* XPath is about 1000% faster than DOM queries on an Opera platform
* the expression hack is about 200-400% faster on an IE platform
* Behaviour leaks like a sieve

Kevin Henrikson
Kevin Henrikson is a seasoned technology executive and entrepreneur with deep expertise in building productivity tools and scaling engineering teams. After serving as Vice President of Engineering at Instacart, where he led the Shopper & Fulfillment Engineering organization, he became the founder and CEO of Dust Labs. Prior to Instacart, Kevin co-founded Acompli, which was acquired by Microsoft; there, he led engineering for Outlook on iOS, Android, and Mac. Earlier in his career, he played key roles at Zimbra, contributing to its acquisition by Yahoo! for $350 million. Kevin is also the co-founder and former CTO of Alpha Brand Media, a digital media publishing company. As an angel investor, he supports entrepreneurs working on disruptive solutions in mobile, crypto, enterprise SaaS, and consumer internet sectors.
Kevin Henrikson
Kevin Henrikson

Latest posts by Kevin Henrikson (see all)

By Kevin Henrikson

Kevin Henrikson is a seasoned technology executive and entrepreneur with deep expertise in building productivity tools and scaling engineering teams. After serving as Vice President of Engineering at Instacart, where he led the Shopper & Fulfillment Engineering organization, he became the founder and CEO of Dust Labs. Prior to Instacart, Kevin co-founded Acompli, which was acquired by Microsoft; there, he led engineering for Outlook on iOS, Android, and Mac. Earlier in his career, he played key roles at Zimbra, contributing to its acquisition by Yahoo! for $350 million. Kevin is also the co-founder and former CTO of Alpha Brand Media, a digital media publishing company. As an angel investor, he supports entrepreneurs working on disruptive solutions in mobile, crypto, enterprise SaaS, and consumer internet sectors.