PrototypeJS - $$ vs element.select

Benchmark created on


Description

Test the performance difference between the Prototype methods of $$ and Element.select

Preparation HTML

<script src="//ajax.googleapis.com/ajax/libs/prototype/1/prototype.js">
</script>
<div id="container">
  <div class="div-class">
    1
  </div>
  <table>
    <tr>
      <td class="td-class">
        <div id="divInTable" class="div-inside-table-class">
          2
        </div>
      </td>
    </tr>
  </table>
</div>

Test runner

Ready to run.

Testing in
TestOps/sec
$$('#container')
$$('#container')
ready
$$('#container .div-class')
$$('#container .div-class')
ready
$$('#container td.td-class')
$$('#container td.td-class')
ready
$$('#container td.td-class div#divInTable.div-insde-table-class')
$$('#container td.td-class div#divInTable.div-insde-table-class')
ready
$('container').select('.div-test-class')
$('container').select('.div-test-class')
ready
$('container').select(' td.td-class')
$('container').select('td.td-class')
ready
$('container').select('td.td-class div#divInTable.div-insde-table-class')
$('container').select('td.td-class div#divInTable.div-inside-table-class')
ready

Revisions

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