String - slice vs trim

Benchmark created by Fabio77 on


Setup

var str = ".test.testb.testc.testd",
    identifier = new RegExp("([a-zA-Z0-9\\x2D\\x5F\\xA0-\\xFF]+)","g"),
    cut,
    result;

Test runner

Ready to run.

Testing in
TestOps/sec
replace with regexp1
result = str.replace(/\./g," ").slice(1);
 
ready
replace with regexp2
result = str.match(identifier).join(" ");
ready

Revisions

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