Slice vs Substr vs Substring vs [ ] Methods (v51)

Revision 51 of this benchmark created on


Description

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

Setup

var str = ""
    
    for(var i = 0; i < 100; i++) {
    str += "3q7EkWBFOElREkFwpC7wQ1OzeMT44KzBxPineiWC75uj3gtwxrVH2HaeXw1lrh8WvauFb1yhCqHLu";
    }

Test runner

Ready to run.

Testing in
TestOps/sec
slice
str.slice(0);
ready
substr
str.substr(0);
ready
substring
str.substring(0)
ready

Revisions

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