Ruby profiler: add require "profile" to the start of your code : profile « Development « Ruby






Ruby profiler: add require "profile" to the start of your code


# , or run it with ruby --r profile before your source file name.

require 'profile'
class Calculator
  def self.count_to_large_number
    x = 0
    100000.times { x += 1 }
  end

  def self.count_to_small_number
    x = 0
    1000.times { x += 1 }
  end
end

Calculator.count_to_large_number
Calculator.count_to_small_number

 








Related examples in the same category

1.Profiling Your Application