split/join vs regex replace (v2)

Revision 2 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
str.split(' ').join(delim)
ready
regex replace
str.replace(/ /g, delim)
ready
split/join with regex
str.split(/ /g).join(delim)
ready
split/join with regex2
str.split(/ /).join(delim)
ready
regex replace2
str.replace(/ /, delim)
ready

Revisions

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