Replace All vs Split/Join (v46)

Revision 46 of this benchmark created by Gabriel Walt on


Setup

str = "Test abc test test abc test...";
    searchStr = "abc";
    searchReg = /abc/g;
    replaceStr = "";

Test runner

Ready to run.

Testing in
TestOps/sec
split & join
str.split(searchStr).join(replaceStr);
ready
replace
str.replace(searchReg, replaceStr);
ready

Revisions

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