replace() or substr() or slice() (v12)

Revision 12 of this benchmark created on


Setup

var str = "data-test";
    var regEx = /^data-/i;

Test runner

Ready to run.

Testing in
TestOps/sec
substr
str = str.substr(5, str.length-1);
ready
replace
str = str.replace(regEx, '');
ready

Revisions

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