Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save richardc/bab8cb2dc3211691919e to your computer and use it in GitHub Desktop.
Save richardc/bab8cb2dc3211691919e to your computer and use it in GitHub Desktop.
SymbolProc basic bench
user system total real
block 6.950000 0.220000 7.170000 ( 5.177000)
SymbolProc 5.500000 0.090000 5.590000 ( 5.082000)
user system total real
block 6.510000 0.260000 6.770000 ( 6.800353)
SymbolProc 6.060000 0.260000 6.320000 ( 6.320873)
user system total real
block 6.440000 0.240000 6.680000 ( 6.692680)
SymbolProc 6.140000 0.210000 6.350000 ( 6.362771)
require 'benchmark'
a = 1..50000
n = 500
Benchmark.bm do |x|
x.report('block') do
n.times do
mapped = a.map { |i| i.to_s }
end
end
x.report('SymbolProc') do
n.times do
mapped = a.map(&:to_s)
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment