I have a Ruby program that takes about 4 minutes to complete task and I'd like to get it down to under 1 minute.
I tried ruby-prof from gem but enabling it increases running times to ~30 minutes, and doesn't even seem to preserve monotonicity particularly well (some changes reliably improve performance-with-profiler and as reliably deteriorate performance-without-profiler). This task also cannot really be broken down into parts that can be meaningfully profiled independently.
What's the current best way to profile Ruby code with lowest overhead?
I use OSX, but if for any reason profiler requires another OS, I might reboot.
EDIT: perftools.rb
has much lower overhead, but results look rather dubious to be honest, way outside any reasonable sampling error - at the very least it must be messing with GC or i/o buffering or something like that, causing a lot of silly misattributions. It still beats ruby-prof.
I'll keep the question open in case someone knows anything better than that.