deselect-select

JavaScript performance comparison

Test case created by

Preparation code

<script src="https://code.jquery.com/jquery-1.11.1.min.js"></script>
<select>
  <option>Choose a select</option>
  <option value="1">1</option>
  <option value="2">2</option>
  <option value="3">3</option>
</select>
      
<script>
Benchmark.prototype.setup = function() {
  $('select').prop('selectedIndex', 2);

};
</script>

Preparation code output

<select> <option>Choose a select</option> <option value="1">1</option> <option value="2">2</option> <option value="3">3</option> </select>

Test runner

Warning! For accurate results, please disable Firebug before running the tests. (Why?)

Java applet disabled.

Testing in CCBot 2.0.0 / Other 0.0.0
Test Ops/sec
jquery
$('select').val([])
pending…
native
var select = document.querySelector('select');
select.selectedIndex = -1;
pending…
both
$('select')[0].selectedIndex = -1;
pending…

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

Compare results of other browsers

0 Comments