Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- require 'benchmark'
- GC.start
- m1 = Benchmark.measure do
- 1_000_000.times do
- arr = [[1.1, 2.2, 3.3], [4.1, 5.6, 6.8], [7.1, 8.7, 9.0], [10.0, 11.4, 12.6]]
- arr.map{|y| y.map{|z| z.to_i}}
- end
- end
- GC.start
- m2 = Benchmark.measure do
- 1_000_000.times do
- arr = [[1.1, 2.2, 3.3], [4.1, 5.6, 6.8], [7.1, 8.7, 9.0], [10.0, 11.4, 12.6]]
- arr.each{|y| y.map!{|z| z.to_i}}
- end
- end
- puts m1, m2
Add Comment
Please, Sign In to add comment