Test name | Executions per second |
---|---|
String.replaceAll | 255044.1 Ops/sec |
split and join | 893894.2 Ops/sec |
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?';
p.replaceAll('dog', 'monkey');
p.split('dog').join('monkey');