uncurryThis

Benchmark created by Sindre Sorhus on


Setup

function uncurryThis(f){return f.call.bind(f)};
    var fn = uncurryThis(String.prototype.toUpperCase);
    
    var uncurryThis2 = Function.bind.bind(Function.call);
    var fn2 = uncurryThis2(String.prototype.toUpperCase);
    
    Function.prototype.uncurryThis3=function(){var f=this;return function(){var a=arguments,b=[].slice(a,1);return f.apply(a[0],b)}}
    var fn3 = String.prototype.toUpperCase.uncurryThis3();
    
    Function.prototype.uncurryThis4=function(){var f=this;return function() {return f.call.apply(f,arguments)}};
    var fn4 = String.prototype.toUpperCase.uncurryThis4();

Test runner

Ready to run.

Testing in
TestOps/sec
f.call.bind
fn('unicorn');
ready
Function.bind.bind
fn2('unicorn');
ready
Function.prototype ... [].slice(a,1)
fn3('unicorn');
ready
Function.prototype ... f.call.apply
fn4('unicorn');
ready

Revisions

You can edit these tests or add more tests to this page by appending /edit to the URL.

  • Revision 1: published by Sindre Sorhus on