test

JavaScript performance comparison

Revision 8 of this test case created

Preparation code

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

<div id="trollen" class="zz">
<div class="zz"></div
</div>
<script>
Benchmark.prototype.setup = function() {
    var o = {1:1, 2:2};
    var n = 0;
    var s = 'string';
   
    var el = $('#trollen')[0];
   
    function get(selector, selectorParent){
                selectorParent = undefined === selectorParent ? document : get(selectorParent);
                return is(selector) ? selector : selectorParent.querySelector(selector);
        }
   
    function is(element){
                return element && element.nodeType;
        }
};
</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
1
el instanceof Node
pending…
2
el && el.nodeType
pending…

Compare results of other browsers

Revisions

You can edit these tests or add even more tests to this page by appending /edit to the URL. Here’s a list of current revisions for this page:

0 comments

Add a comment