Reverse String Performance Test (v2)

Revision 2 of this benchmark created on


Test runner

Ready to run.

Testing in
TestOps/sec
Array.from
function reverseString(inputString) {
    return Array.from(
        { length: inputString.length }, 
        (_, charIndex) => inputString[inputString.length - 1 - charIndex])
        .join('');
}

reverseString('pneumonoultramicroscopicsilicovolcanoconiosis')

ready
For
function reverseString(inputString) {
    let reversedString = '';

    for (let i = inputString.length - 1; i >= 0; i--) {
        reversedString += inputString[i];
    }

    return reversedString;
}

reverseString('pneumonoultramicroscopicsilicovolcanoconiosis')

ready

Revisions

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