XPath vs querySelectorAll

Benchmark created by JoeSimmons on


Preparation HTML

<table>
    <tbody>
        <tr>
            <td>
                <a href="/foo">
                    <img src="/bar.jpg" alt="" />
                </a>
            </td>
        </tr>
    </tbody>
</table>

Test runner

Ready to run.

Testing in
TestOps/sec
XPath
document.evaluate('//td/a/img', document, null, 7, null);
ready
querySelectorAll
document.querySelectorAll('td > a > img');
ready

Revisions

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

  • Revision 1: published by JoeSimmons on