Substring vs replace (v3)

Revision 3 of this benchmark created on


Preparation HTML

<script>
  var str = '#test_me_sideways';
  var newStr = undefined;
</script>

Test runner

Ready to run.

Testing in
TestOps/sec
Replace
test.split('_')[0].replace('#', '')
ready
Substring
var newStr = str.substr(1,4);
ready

Revisions

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