Visualize with KCachegrind (QCachegrind)
Ruby-prof can generate profiles in so-called callgrind format. This is the format used by the Valgrind profiler used in the C and C++ world. With the CallTreePrinter, you can obtain the callgrind-formatted profile and reuse some of the best visualization tools developed by C/C++ programmers.
KCachegrind is, in my opinion, the best such tool. It comes as a part of all major Linux distributions. Its version for Mac OS and Windows is called QCachegrind. On Mac you can install it via MacPorts or Homebrew. On Windows you can use precompiled packages.
If you want to follow along, install it now, if necessary. And then let’s take our example application and generate the callgrind output. Add this ...