Created
March 16, 2012 05:31
-
-
Save hughevans/2048678 to your computer and use it in GitHub Desktop.
String concat speed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| user system total real | |
| 0.050000 0.000000 0.050000 ( 0.043481) | |
| 0.100000 0.010000 0.110000 ( 0.107440) | |
| 0.060000 0.000000 0.060000 ( 0.062976) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require 'benchmark' | |
| first_name, last_name, x = 'Hugh', 'Evans', 100000 | |
| Benchmark.bm do |b| | |
| b.report { x.times { "#{first_name} #{last_name}" }} | |
| b.report { x.times { [first_name, last_name].join(' ') }} | |
| b.report { x.times { first_name + ' ' + last_name }} | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment