Which is the best graphical ruby profiler?

2.1k Views Asked by At

The best match that I have found until now is to use ruby-prof from command line and try to guess the graph reading from there.

require 'ruby-prof'

# Profile the code
RubyProf.start
...
[code to profile]
...
result = RubyProf.stop

# Print a flat profile to text
printer = RubyProf::FlatPrinter.new(result)
printer.print(STDOUT)

https://github.com/rdp/ruby-prof

The main problem with this approach is that you have to modify your code to see the profiling and is not very readable.

Also I have tried if some IDEs: RubyMine, Aptana and Netbeans and no one has a proper graphical interface to profile code.

Any recommendation?

2

There are 2 best solutions below

0
On

Try the ruby-prof command line tool: http://ruby-prof.rubyforge.org/files/bin/ruby-prof.html

And use something like following:

ruby-prof -p graph_html -f filename.html rubycode.rb
0
On

Checkout mini-profiler: http://railscasts.com/episodes/368-miniprofiler

Documentation can be found here: https://github.com/SamSaffron/MiniProfiler/tree/master/Ruby

Checkout special parameter: pp=flamegraph - it's amazingly easy to profile. For ruby 2.0 it works even on production!