Test case details

Preparation Code

<script src="//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"> </script> <script src="//cdnjs.cloudflare.com/ajax/libs/underscore.js/1.3.3/underscore-min.js"> </script>

Test cases

Test #1

var foo = (function(x) {   return this + x; }).bind(1); for (var i = 0; i < 1000; ++i)   foo(i);

Test #2

var foo = jQuery.proxy(function(x) {   return this + x; }, 1); for (var i = 0; i < 1000; ++i)   foo(i);

Test #3

var foo = _.bind(function(x) {   return this + x; }, 1); for (var i = 0; i < 1000; ++i)   foo(i);

Test #4

var bar = function(x) {   return this + x; }; var foo = function(x) {   bar.call(1, x); } for (var i = 0; i < 1000; ++i)   foo(i);