Whitespace regexp remove vs split-join

Benchmark created by Per on


Setup

var str = "The quick brown fox jumps over the lazy dog";

Test runner

Ready to run.

Testing in
TestOps/sec
Regexp
var newStr = str.replace(/ /g, "");
ready
Split-join
var newStr = str.split(" ").join("");
ready

Revisions

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