Profile and easure the efficiency of a ruby application
# Install the gem
# $ gem install ruby-prof
# Or add it to Gemfile
# Initialize the profiler
RubyProf.start
# Do some heavy stuff
# ...
# Save the results and print them into an HTML file
result = RubyProf.stop
printer = RubyProf::CallStackPrinter.new(result)
File.open(Rails.root.join('tmp', 'profile_output.html'), 'w') do |file|
printer.print(file, print_file: true)
end