dgfgghfghfghghgfhgfhfghfhgfh

JavaScript performance comparison

Test case created by cc and last updated

Preparation code

<script>
var ar = [1, 2, 3, 4, 5, 6, 7, 8, 9, 2, 3, 4, 5, 6, 7, 8, 9, 9, 2, 3, 4, 5, 6, 7, 8, 9, 9, 2, 3, 4, 5, 6, 7, 8, 9, 9, 2, 3, 4, 5, 6, 7, 8, 9, 9, 2, 3, 4, 5, 6, 7, 8, 9, 9, 2, 3, 4, 5, 6, 7, 8, 9, 9, 2, 3, 4, 5, 6, 7, 8, 9, 9, 2, 3, 4, 5, 6, 7, 8, 9, 9, 2, 3, 4, 5, 6, 7, 8, 9, 9, 2, 3, 4, 5, 6, 7, 8, 9, 9, 2, 3, 4, 5, 6, 7, 8, 9, 9, 2, 3, 4, 5, 6, 7, 8, 9, 9, 2, 3, 4, 5, 6, 7, 8, 9, 9, 2, 3, 4, 5, 6, 7, 8, 9, 9, 2, 3, 4, 5, 6, 7, 8, 9, 9, 2, 3, 4, 5, 6, 7, 8, 9, 9, 2, 3, 4, 5, 6, 7, 8, 9, 9, 2, 3, 4, 5, 6, 7, 8, 9, 9, 2, 3, 4, 5, 6, 7, 8, 9, 9, 2, 3, 4, 5, 6, 7, 8, 9, 9, 2, 3, 4, 5, '55', 7, 8, 9, 9, 2, 3, 4, 5, 6, 7, 8, 9, 9, 2, 3, 4, 5, 6, 7, 8, 9];
function cc5(a,b,c){
 c=a.length;
 while(c!=-1&&b!=a[--c]);
 //while(c>-1&&b!=a[--c]);
 //while(--c!=-1&&b!=a[c]);
 return c
}
function cc3(a,b,c,d,e){//value,array,placeholder
 for(d=0,c=a.length,e=false;d<c;b!=a[d++]||(e=true,d=c));
 return e
}
function cc4(a,b,c,d){//value,array,placeholder
 for(
  d=0,c=a.length;
  d<c;//console.log(d),
  b!=a[d++]||(d=c+1)
 );
 return (a,d,c,d)
}

function cc6(a,b,c){
 c=a.length;
 //while(c!=-1&&b!=a[--c]);
 //while(c>-1&&b!=a[--c]);
 while(!(b==a[--c]||c<0));
 //while(--c!=-1&&b!=a[c]);
 return c
}
</script>
    

Test runner

Warning! For accurate results, please disable Firebug before running the tests. (Why?)

Java applet disabled.

Testing in CCBot 2.0.0 / Other 0.0.0
Test Ops/sec
cc5
cc5(ar,55)
pending…
indexOf
ar.indexOf('55')!==-1
pending…
lastIndexOf
ar.lastIndexOf('55')!==-1
pending…
cc6
cc6(ar,55)
pending…

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

Compare results of other browsers

0 Comments