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

Revision 120 of this benchmark created on


Description

This is comparing the runtimes of substr, substring, and slice in a string for short string size.

Setup

var str = "DzjKbdy1fysm5LiEbCNUmbl9wqaAKL0o6Uqh3";

Test runner

Ready to run.

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

Revisions

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