Created
June 18, 2017 14:13
-
-
Save rhysd/0c7d256aaeeb48b9bc7181a333958143 to your computer and use it in GitHub Desktop.
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
#!/usr/bin/env ruby | |
require 'benchmark' | |
puts Benchmark.measure { | |
s = "" | |
5000000.times do | |
s << "hey, hey, " | |
end | |
} | |
puts Benchmark.measure { | |
s = StringIO.new | |
5000000.times do | |
s << "hey, hey, " | |
end | |
s.string | |
} |
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
0.510000 0.020000 0.530000 ( 0.532377) | |
0.820000 0.030000 0.850000 ( 0.848875) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment