Sha256: 59e030188ab97648f17e384373c5cc8fc609552688e1aafd2c8f07fc0f2749f2

Contents?: true

Size: 527 Bytes

Versions: 18

Compression:

Stored size: 527 Bytes

Contents

require 'benchmark/ips'

puts "Ruby #{RUBY_VERSION} at #{Time.now}"
puts

firstname = 'soundarapandian'
middlename = 'rathinasamy'
lastname = 'arumugam'

Benchmark.ips do |x|
	x.report("String\#<<") do |i|
		buffer = String.new
		
		while (i -= 1) > 0
			buffer << 'Mr. ' << firstname << middlename << lastname << ' aka soundar'
		end
	end
	
	x.report("String interpolate") do |i|
		buffer = String.new
		
		while (i -= 1) > 0
			buffer << "Mr. #{firstname} #{middlename} #{lastname} aka soundar"
		end
	end
	
	x.compare!
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
trenni-3.7.1 benchmark/interpolation_vs_concat.rb
trenni-3.7.0 benchmark/interpolation_vs_concat.rb
trenni-3.6.1 benchmark/interpolation_vs_concat.rb
trenni-3.6.0 benchmark/interpolation_vs_concat.rb
trenni-3.5.0 benchmark/interpolation_vs_concat.rb
trenni-3.4.0 benchmark/interpolation_vs_concat.rb
trenni-3.3.0 benchmark/interpolation_vs_concat.rb
trenni-3.2.0 benchmark/interpolation_vs_concat.rb
trenni-3.1.3 benchmark/interpolation_vs_concat.rb
trenni-3.1.2 benchmark/interpolation_vs_concat.rb
trenni-3.1.1 benchmark/interpolation_vs_concat.rb
trenni-3.1.0 benchmark/interpolation_vs_concat.rb
trenni-3.0.4 benchmark/interpolation_vs_concat.rb
trenni-3.0.3 benchmark/interpolation_vs_concat.rb
trenni-3.0.0 benchmark/interpolation_vs_concat.rb
trenni-2.1.0 benchmark/interpolation_vs_concat.rb
trenni-2.0.2 benchmark/interpolation_vs_concat.rb
trenni-2.0.1 benchmark/interpolation_vs_concat.rb