for loop: create functions (v287)

Revision 287 of this benchmark created by Luis Reis on


Setup

var array = [];

Test runner

Ready to run.

Testing in
TestOps/sec
simple iteration
for (var i = 0; i < 10000; i++) {
 array.push(i);
};
ready
inner function
for (var i = 0; i < 10000; i++) {
 var anon = function(){
   array.push(i);
 }
 anon();
};
ready
closure
function closeIt(array) {
  return function(x) { array.push(i); }
}

for (var i = 0; i < 10000; i++) {
  closeIt(array)(i);
};
ready

Revisions

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