Skip to content

Instantly share code, notes, and snippets.

@TonnyXu
Created February 27, 2010 13:40
Show Gist options
  • Save TonnyXu/316695 to your computer and use it in GitHub Desktop.
Save TonnyXu/316695 to your computer and use it in GitHub Desktop.
Original String:1234567890
Reversed String: 0987654321(Reverse by array)
Original String:1234567890
Reversed String: 0987654321(Reverse by array 2)
Original String:1234567890
Reversed String: 0987654321(Reverse by api)
--------
Original String:123
Reversed String: 321(Reverse by array)
Original String:123
Reversed String: 321(Reverse by array 2)
Original String:123
Reversed String: 321(Reverse by api)
--------
Original String:僕らの日本語
Reversed String: 語本日のら僕(Reverse by array)
Original String:僕らの日本語
Reversed String: 語本日のら僕(Reverse by array 2)
Original String:僕らの日本語
Reversed String: 語本日のら僕(Reverse by api)
--------
4494124 ns, Reverse by array (10000 times, length:3)
2630482 ns, Reverse by array 2 (10000 times, length:3)
16486374 ns, Reverse by API (10000 times, length:3)
--------
1705699 ns, Reverse by array (10000 times, length:10)
1103404 ns, Reverse by array 2 (10000 times, length:10)
2576807 ns, Reverse by API (10000 times, length:10)
--------
6599301 ns, Reverse by array (10000 times, length:100)
4976313 ns, Reverse by array 2 (10000 times, length:100)
6939825 ns, Reverse by API (10000 times, length:100)
--------
64924804 ns, Reverse by array (10000 times, length:1000)
31968774 ns, Reverse by array 2 (10000 times, length:1000)
54151224 ns, Reverse by API (10000 times, length:1000)
--------
607158130 ns, Reverse by array (10000 times, length:10000)
334346546 ns, Reverse by array 2 (10000 times, length:10000)
447884000 ns, Reverse by API (10000 times, length:10000)
--------
3462514210 ns, Reverse by array (10000 times, length:50000)
2004866764 ns, Reverse by array 2 (10000 times, length:50000)
2517949219 ns, Reverse by API (10000 times, length:50000)
--------
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment