_.partial vs. _.bind

JavaScript performance comparison

Test case created by Eric

Preparation code

<script src="//raw.github.com/bestiejs/lodash/v1.0.0/dist/lodash.underscore.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
Using _.bind
var add = function(a, b) {
    return a + b;
    };

var addTen = _.bind(add, this, 10);

addTen(20);
pending…
Using _.partial
var add = function(a, b) {
    return a + b;
    };

var addTen = _.partial(add, 10);

addTen(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