replace(string) or replace(regex) (v7)

Revision 7 of this benchmark created on


Setup

var msg = "hello, world!";
    var str = "world";
    var regEx = /world/gi;

Test runner

Ready to run.

Testing in
TestOps/sec
replace(string)
msg = msg.replace(str, "dude");
ready
replace
str = str.replace(/world/gi, "dude");
ready
precompiled replace
str = str.replace(regEx, "dude");
ready

Revisions

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