waf5wefewf

JavaScript performance comparison

Test case created

Preparation code

 
<script>
Benchmark.prototype.setup = function() {
    var re = /o/
   
    String.prototype.contains = function(char) {
    var l = this.length;
    var result = false;
    while (l--) { if (this[l] === char) result = true }
    return result;
    };
};
</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
retest
 /o/.test('Hello World!');
pending…
index
 'Hello World!'.indexOf('o') > -1;
pending…
rematch
!!'Hello World!'.match(/o/);
pending…
retest construct
re.test('Hello World!')
pending…
contain
'Hello World!'.contains('o')
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