Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
18 lines (13 sloc) 232 Bytes
require 'benchmark/ips'
RANGE = (1..100)
def slow
RANGE.map { |i| i.to_s }
end
def fast
RANGE.map(&:to_s)
end
Benchmark.ips do |x|
x.report('Block') { slow }
x.report('Symbol#to_proc') { fast }
x.compare!
end
You can’t perform that action at this time.