map vs split (reverse string)

Benchmark created by map vs split (reverse string) on


Description

Reversing a string using array.map and string.split.

Setup

var str = "Testing this string, going to reverse it and see how long it takes to do. Fun fun fun fun. I enjoy juggling apricots.";

Test runner

Ready to run.

Testing in
TestOps/sec
map
[].map.call(str, function (i) { return i; }).reverse().join(""); 
ready
split
str.split("").reverse().join("");
ready

Revisions

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

  • Revision 1: published by map vs split (reverse string) on