replace() or substr() (v21)

Revision 21 of this benchmark created on


Setup

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

Test runner

Ready to run.

Testing in
TestOps/sec
substr
str = str.substr(0, str.length-1);
ready
replace
str = str.replace(/\.$/, '');
ready
no regex
str = str.replace('a.aa.a.aa.', '');
ready

Revisions

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