Replace All vs Split/Join (v9)

Revision 9 of this benchmark created on


Setup

str = "Test abc test test abc test...";
    reg_exp = new RegExp('abc', 'g');

Test runner

Ready to run.

Testing in
TestOps/sec
split & join
str.split("abc").join("");
ready
replace
str.replace(/abc/g, '');
ready
replace with cached regexp
str.replace(reg_exp, '');
ready

Revisions

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