Declare variable inside loop or outside - Performance (v92)

Revision 92 of this benchmark created on


Test runner

Ready to run.

Testing in
TestOps/sec
loop
var x;
var i;
for(i=0;i<1000;i++){
    x=i+1234;
}
 
ready
loop 1
for(var i=0;i<1000;i++){
    var x=i+1234;
}
ready
loop 2
var x;
for(var i=0;i<1000;i++){
    x=i+1234;
}
 
ready
loop 3
var x;
for(var i=0;i<1000;i++){
    x=new Array();
}
ready
loop 4
var x;
for(var i=0;i<1000;i++){
    x=[];
}
ready

Revisions

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