indexOf vs test() (v2)

Revision 2 of this benchmark created on


Preparation HTML

";
  };
</script>

Setup

Benchmark.prototype.setup = function() {
    var string = "<script>alert('boo');

Test runner

Ready to run.

Testing in
TestOps/sec
indexOf
if(string.indexOf(';') >= 0) {
}
ready
test()
if(/;/.test(string)) {
}
ready

Revisions

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