_.partial vs. _.bind

JavaScript performance comparison

Revision 3 of this test case created

Preparation code

<script src="//rawgithub.com/bestiejs/lodash/v1.0.0/dist/lodash.underscore.min.js"></script>
 
<script>
Benchmark.prototype.setup = function() {
    var add = function(a, b) {
        return a + b;
        };
   
    var addTenBind = _.bind(add, this, 10);
    var addTenPartial = _.partial(add, 10);
   
};
</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
Using _.bind
addTenBind(20);
pending…
Using _.partial
addTenPartial(20);
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