xpath evaluate vs. querySelector -- Attribute selector (v65)

Revision 65 of this benchmark created by Cory on


Description

Compare the speed of xpath evaluate to querySelector on attribute selection

Preparation HTML

<p title="foo">Foo</p>
<p title="bar">Bar</p>
<p title="baz">Baz</p>

Test runner

Ready to run.

Testing in
TestOps/sec
xpath evaluate
var bar = document.evaluate("//*[@title='bar']",document,null,9,null).singleNodeValue;
ready
querySelector
var bar = document.querySelector('[title="bar"]');
ready
xpath evaluate (firefox id function)
var bar = document.evaluate("title('bar')",document,null,9,null).singleNodeValue;
ready

Revisions

You can edit these tests or add more tests to this page by appending /edit to the URL.