Skip to content

Instantly share code, notes, and snippets.

@komagata
Created October 30, 2015 09:40
Show Gist options
  • Save komagata/bf567c528b4467cdb046 to your computer and use it in GitHub Desktop.
Save komagata/bf567c528b4467cdb046 to your computer and use it in GitHub Desktop.
require 'benchmark'
num = 1000000
Benchmark.bm 2 do |r|
r.report '+' do
str = ''
num.times do
str = 'a' + 'b'
end
end
r.report '<<' do
str = ''
num.times do
str = 'a' << 'b'
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment