Pseudo vs Native

JavaScript performance comparison

Test case created by Chris

Info

Evaluating whether this:

var conceptName = $('#aioConceptName :selected').text();

is faster than this:

var conceptName = $('#aioConceptName').find(":selected").text();

Preparation code

<select id="aioConceptName">
<option value="1">test 1</option>
<option value="2">test 2</option>
<option value="3">test 3</option>
<option value="4" selected="selected">test 4</option>
<option value="5">test 5</option>
<option value="6">test 6</option>

</select>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>

Preparation code output

Test runner

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

Java applet disabled.

Testing in unknown unknown
Test Ops/sec
Pseudo
var conceptName = $('#aioConceptName :selected').text();
pending…
Native-ish
var conceptName = $('#aioConceptName').find(":selected").text();
pending…
var conceptName = $('#aioConceptName').val();
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

Add a comment