.replace() vs. .split().join() vs .replaceAll() - BIG (v14)

Revision 14 of this benchmark created on


Setup

var mystring = 'okayAthisAisAaAstring';

Test runner

Ready to run.

Testing in
TestOps/sec
.replace(/\./g,' ')
result = mystring.replace(/A/g,' test ');
ready
.replace(new RegExp(".","gm")," ")
result = mystring.replace(new RegExp("A","gm")," test ");
ready
.split('.').join(' ')
result = mystring.split('A').join(' test ');
ready

Revisions

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