RegExp vs indexOf (v5)

Revision 5 of this benchmark created on


Description

Compare speed of Regex with indexOf for simple string comparison

Test runner

Ready to run.

Testing in
TestOps/sec
Regex
var isPresent = new RegExp('qwerty$');
var url = "qwerty-qwerty";

if (isPresent.test(url)) {
  // no op
}
ready
indexOf
var url = "qwerty-qwerty";

if (url.endsWith('qwerty')) {
  // no op
}
ready

Revisions

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