Is there a way to profile ruby 1.9.2 scripts with

2019-02-04 22:18发布

问题:

I'm running into bottlenecks in my ruby application, but I can't figure out where it's slowing down. I found memprof, but it doesn't support 1.9. I also found ruby-prof which seems to work fine on 1.9.2, but the memory allocation requires a patched ruby interpreter and I can only find patches for ruby 1.8. Is there a ruby profiler out there that does the job?

回答1:

Have you tried profiling the GC? Ruby 1.9.2 includes GC::Profiler.

GC::Profiler.enable
GC.start
puts GC::Profiler.report

You may also want to look at ObjectSpace.count_objects.