Run details:
Mozilla/5.0 (Macintosh; Intel Mac OS X 11_1_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.96 Safari/537.36
Chrome 88
Mac OS X 11.1.0
Desktop
4 years ago
Test name Executions per second
String.replaceAll 255044.1 Ops/sec
split and join 893894.2 Ops/sec
Script Preparation code:
AخA
 
var p = 'The quick brown fox jumps over the lazy dog. If the dog reacted, was it really lazy?The quick brown fox jumps over the lazy dog. If the dog reacted, was it really lazy?The quick brown fox jumps over the lazy dog. If the dog reacted, was it really lazy?The quick brown fox jumps over the lazy dog. If the dog reacted, was it really lazy?The quick brown fox jumps over the lazy dog. If the dog reacted, was it really lazy?The quick brown fox jumps over the lazy dog. If the dog reacted, was it really lazy?The quick brown fox jumps over the lazy dog. If the dog reacted, was it really lazy?The quick brown fox jumps over the lazy dog. If the dog reacted, was it really lazy?The quick brown fox jumps over the lazy dog. If the dog reacted, was it really lazy?';
Tests:
  • String.replaceAll

     
    p.replaceAll('dog', 'monkey');
  • split and join

     
    p.split('dog').join('monkey');