string reverse

Benchmark created on


Description

reverse a text string

Setup

const str = "hello world";
const longstr = "hello world hello world hello world hello world hello world hello world hello world hello world hello world hello world hello world hello world hello world hello world hello world hello world hello world hello world hello world hello world hello world hello world hello world hello world hello world hello world hello world hello world hello world hello world hello world hello world hello world hello world hello world hello world hello world hello world hello world hello world hello world hello world hello world hello world hello world hello world hello world hello world hello world hello world hello world hello world hello world hello world hello world hello world hello world hello world hello world hello world hello world hello world hello world hello world hello world hello world hello world hello world hello world hello world hello world hello world hello world hello world hello world hello world hello world hello world hello world hello world hello world hello world hello world hello world hello world hello world hello world hello world hello world hello world hello world";

Test runner

Ready to run.

Testing in
TestOps/sec
split/rev/join short
return str.split("").reverse().join("");
ready
split/rev/join long
return longstr.split("").reverse().join("");
ready
loop short
let rev;

for(let i = str.length-1; i>0; i--) {
	rev += str[i];
}
return rev;
ready
loop long
let rev;

for(let i = longstr.length-1; i>0; i--) {
	rev += longstr[i];
}
return rev;
ready

Revisions

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