Replace All vs Split/Join

JavaScript performance comparison

Revision 57 of this test case created by

Preparation code

Benchmark.prototype.setup = function() {
  var str = "Courage of our questions explorations light years something incredible is waiting to be known. A very small stage in a vast cosmic arena venture! Science rich in heavy atoms across the centuries concept of the number one cosmic ocean preserve and cherish that pale blue dot decipherment Sea of Tranquility are creatures of the cosmos kindling the energy hidden in matter! Prime number Rig Veda shores of the cosmic ocean, dispassionate extraterrestrial observer vanquish the impossible descended from astronomers network of wormholes the carbon in our apple pies emerged into consciousness quasar rogue the ash of stellar alchemy dream of the mind's eye! Across the centuries. Emerged into consciousness worldlets!";


Test runner

Warning! For accurate results, please disable Firebug before running the tests. (Why?)

Java applet disabled.

Testing in CCBot 2.0.0 / Other 0.0.0
Test Ops/sec
split & join
str.replace(new RegExp('the', 'gm'), 'yjr');

Compare results of other browsers


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