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 leads engineering for Microsoft Outlook iOS/Android. Previously, he co-founded Acompli and ran engineering prior to an acquisition by Microsoft in 2014 for $200M. Before Acompli, he was an Entrepreneur-in-Residence for Redpoint Ventures, a venture capital firm for early stage technology companies.

By Kevin Henrikson

Kevin Henrikson leads engineering for Microsoft Outlook iOS/Android. Previously, he co-founded Acompli and ran engineering prior to an acquisition by Microsoft in 2014 for $200M. Before Acompli, he was an Entrepreneur-in-Residence for Redpoint Ventures, a venture capital firm for early stage technology companies.