eval vs. jquery selector

JavaScript performance comparison

Revision 97 of this test case created

Info

Compare the speed of jquery selector to eval

Preparation code

<script src="//cdnjs.cloudflare.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/underscore.js/1.6.0/underscore-min.js"></script>
<script>
  Benchmark.prototype.setup = function() {
    var funct = function() { console.log("testing") };
    var notFunct = "Hello!"
  };
</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
eval
eval(funct).apply(this,null);
pending…
jquery
$(funct).call(this,null);
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