split/join vs regex replace (v13)

Revision 13 of this benchmark created on


Preparation HTML

<script>
  var str = 'charlie alpha foxtrot beta gamma delta omega iota kappa lambda mu nu xi omicron theta eta zeta',
      delim = ', ';
</script>

Test runner

Ready to run.

Testing in
TestOps/sec
split/join
x = str.split(' ')[0]
if (x === 'charlie') {
 x = true;
}
ready
regex replace
if (str.indexOf('charlie') === 0) {
  x = true;
}
ready

Revisions

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