replace() or substr() (v2)

Revision 2 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
slice
str = str.slice(0,str.length-1)
ready

Revisions

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