Some of our code has been slow for a while. Now that we are importing more sites its come to a point where profiling and optimizing is a necessity.
ruby-prof is a great tool for profiling your ruby code. For instance I can do the following:
SITE=mysite ruby-prof -p call_tree -f ~/s3/doc/profile/mysite_importing_call_tree.kcg convert.rb
That will output a call tree file that can be read by another great program: KCachegrind. KCachegrind helps you sort and visualize what is taking up the most time. In the screenshot attached you can see that Kernel::clone takes up 5% of the whole process.
Read more about ruby-prof Read more about KCachegrind