curry cost (v5)

Revision 5 of this benchmark created by spion on


Preparation HTML

<script>
var curried = function(x){
  return function(y){
     return x + y;
  };
};

var precurried = curried(1);

var notcurried = function(x, y){
   return x + y;
};
</script>

Test runner

Ready to run.

Testing in
TestOps/sec
curried
var s = 0;
for (var k = 0; k < 100; ++k) {
  s += curried(1)(2);
}
if (s != 300) die();
ready
not curried
var s = 0;
for (var k = 0; k < 100; ++k) {
  s += notcurried(1, 2);
}
if (s != 300) die();
ready
pre curried
var s = 0;
for (var k = 0; k < 100; ++k) {
  s += precurried(2);
}
if (s != 300) die();
ready

Revisions

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