Benchmark and measure execution time your Ruby methods without an
additional code changes:
https://github.com/igorkasyanchuk/benchmark_methods
Please put a star if you like it!
Thank you! Your feedback is appreciated.
Sample:
class User < ActiveRecord::Base
include BenchmarkMethods
benchmark :generate_report
cbenchmark :import_users
def generate_report
report = reports.create(name: 'My Report')
report.add_db_data
report.generate
report
end
def self.import_users(csv)
CSV.parse(csv) do |row|
process_import_user(row)
end
end
end
--
Posted via http://www.ruby-forum.com/.
--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/1960dc4ef24355394bfa49b577ad6e3e%40ruby-forum.com.
For more options, visit https://groups.google.com/d/optout.
No comments:
Post a Comment