Ruby - Ecosystem and Best Practices
You want to profile only the slowest part of this code:
How can you modify the code to profile only the slow part?
require 'benchmark'
result = Benchmark.measure do
fast = (1..1000).map { |x| x + 1 }
slow = (1..100000).map { |x| x * 2 }
end
puts result.real.round(2)How can you modify the code to profile only the slow part?
