replace() or substr() (v10)

Revision 10 of this benchmark created on


Setup

var str = "a.aa.a.aa.";
    var regEx = /\./g;

Test runner

Ready to run.

Testing in
TestOps/sec
substr
str = str.substr(0, str.length-1);
ready
replace
str = str.replace(".", '');
ready
precompiled 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.