Slice vs Substr vs Substring Methods (v101)

Revision 101 of this benchmark created by Arkh on


Description

This is comparing the runtimes of substr, substring, and slice in a string for small (10 character) string size.

Preparation HTML

<script>
  var smallString = "0123456789";
</script>

Test runner

Ready to run.

Testing in
TestOps/sec
Substring (small)
smallString.substring(1);
 
ready
Slice (small)
smallString.slice(1);
ready
Substr (small)
smallString.substr(1);
ready

Revisions

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