check loop speed

JavaScript performance comparison

Test case created by dominic

Info

checks loops speeds

Preparation code

 
<script>
Benchmark.prototype.setup = function() {
    var oneway = "hellodsafasfsafdsfsdafsdfsdfdsafsafasdfdsafsafsafsdafasfsdafsafsadfasfsdafsadfasdfsafdasfafsdafsafsadfsdsafdsdafdsafsdfsdafsfdsa adf saf sdf sdf ssdfsdfdsfsdfsdafafsaffafsfsdafd  sdafsfsdafsdff";
   
    String.prototype.reverseNoArray = function(){
     var s= '', L= this.length;
     while(L){
      s+= this[--L];
     }
     return s;
    }
    String.prototype.reverse = function(){
        return this.split('').reverse().join('');
    }
   
    String.prototype.reverse3 = function(){
        var a="",b=this.split('');
        for (var i = b.length - 1; i >= 0; i--) { a+=b[i] };
        return a;
    }
   
};
</script>

Test runner

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

Java applet disabled.

Testing in unknown unknown
Test Ops/sec
Test1
console.log(oneway.reverse3());
 
pending…
test2
console.log(oneway.reverse());
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

Add a comment