November 2015
Intermediate to advanced
200 pages
4h 26m
English
Ruby-prof can generate several types of human-readable reports. I find three of them to be the most useful: flat, call graph, and call stack reports. (You can see the full list in the ruby-prof documentation.)[10] Each serves a different purpose. But we’re learning by example here, and to show them to you, I’ll need a more sophisticated example to profile.
| chp4/app.rb | |
| | require 'date' |
| | require 'rubygems' |
| | require 'ruby-prof' |
| | |
| | # This generates CSV like |
| | # 1, John McTest, 1980-07-01 |
| | # 2, Peter McGregor, 1985-12-23 |
| | # 3, Sylvia McIntosh, 1989-06-13 |
| | def generate_test_data |
| | 50000.times.map do |i| |
| | name = ["John", "Peter", "Sylvia"][rand(3)] + " " + |
| | ["McTest", "McGregor", "McIntosh" ... |
Read now
Unlock full access