startsWith failure case

JavaScript performance comparison

Revision 66 of this test case created by Ryan Dorson

Preparation code


      
      <script>
Benchmark.prototype.setup = function() {
  a = ["test"];
  for (var i = 0; i < 10000; i++) {
    a.push("some other stuff");
  }
  s = a.join();

};
</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
lastIndexOf
r1 = (s.lastIndexOf("bbb", 0) == 0);
pending…
regex
r1 = (/^bbb/).test(s);
pending…
substring
r1 = (s.substring(0, 3) == "bbb");
pending…
checkChars
r1 = s[0] === 'b' && s[1] === 'b' && s[2] === 'b'
pending…
indexOf
r1 = (s.indexOf("bbb") == 0);
pending…
slice
r1 = (s.slice(0, 3) == "bbb");
pending…
startsWith
r1 = s.startsWith('bbb');
pending…

Revisions

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

0 Comments