Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a way to profile ruby 1.9.2 scripts with memory allocation reports?

Tags:

ruby

profiling

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?

like image 317
Moox Avatar asked Mar 01 '11 15:03

Moox


1 Answers

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.

like image 102
Stephen Waits Avatar answered Nov 12 '22 16:11

Stephen Waits