Created
September 13, 2014 17:11
-
-
Save germs12/e3c25a857e7c504edcaf to your computer and use it in GitHub Desktop.
Measure String Printing
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' | |
tmp = {} | |
tmp['100,000,000'] = Benchmark.measure { | |
100000000.times do |x| | |
puts 'phineas and ferb! ' + x.to_s | |
end | |
} | |
tmp['10,000,000'] = Benchmark.measure { | |
10000000.times do |x| | |
puts 'phineas and ferb! ' + x.to_s | |
end | |
} | |
tmp['1,000,000'] = Benchmark.measure { | |
1000000.times do |x| | |
puts 'phineas and ferb! ' + x.to_s | |
end | |
} | |
tmp['100,000'] = Benchmark.measure { | |
100000.times do |x| | |
puts 'phineas and ferb! ' + x.to_s | |
end | |
} | |
tmp['10,000'] = Benchmark.measure { | |
10000.times do |x| | |
puts 'phineas and ferb! ' + x.to_s | |
end | |
} | |
tmp['1,000'] = Benchmark.measure { | |
1000.times do |x| | |
puts 'phineas and ferb! ' + x.to_s | |
end | |
} | |
tmp['100'] = Benchmark.measure { | |
100.times do |x| | |
puts 'phineas and ferb! ' + x.to_s | |
end | |
} | |
tmp['10'] = Benchmark.measure { | |
10.times do |x| | |
puts 'phineas and ferb! ' + x.to_s | |
end | |
} | |
tmp['1'] = Benchmark.measure { | |
1.times do |x| | |
puts 'phineas and ferb! ' + x.to_s | |
end | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment