Replace All vs Split/Join (v33)

Revision 33 of this benchmark created on


Setup

var i = 'abc'
    var it = "coco"
    var str = "Test {abc} test test {abc} test..."

Test runner

Ready to run.

Testing in
TestOps/sec
split & join
str.split("{" + i + "}").join(it);
ready
replace
str.replace(new RegExp("{" + i + "}", "gi"), it);
ready

Revisions

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