astashov / vim-ruby-debugger

Vim plugin for debugging Ruby applications (using ruby-debug-ide gem)
435 stars 36 forks source link

lsof process search is ungodly slow on osx #57

Closed stephenprater closed 13 years ago

stephenprater commented 13 years ago

I've tried this on both a PPC and an Intel, and I don't think this problem is solvable by fiddling about with system settings. I'm not sure what the problem is even with lsof, but it takes up to 5 minutes for the the debugging processes to be located from MacVim.

astashov commented 13 years ago

Sic! :) Okay, so as usual - please set

let g:ruby_debugger_debug_mode = 1

in .vimrc, and then try again, and then - please send me logs from ~/.vim/bundle/vim-ruby-debugger/tmp (or ~/.vim/tmp/ruby_debugger*)

Thanks! :)

stephenprater commented 13 years ago

I'm sorry, it's not a problem with the plugin - it's a problem with lsof. By default it doesn't come with OSX, so you have to compile it, and the version in MacPorts is unbearably slow on network operations.

Anyway, I've opened a pull request with my patch, so I'm closing this issue now.

astashov commented 13 years ago

Hmm, strange, I have lsof by default in MacOSX. I didn't install it by MacPorts (I actually don't use MacPorts at all):

$ which lsof
/usr/sbin/lsof
stephenprater commented 13 years ago

Actually, it looks like I do too. My bad. I might have compiled it when I was troubleshooting this.

Anyway:

( lsof -i tcp:39768 | grep LISTEN | awk '{print $2}'; )  0.05s user 17.58s system 97% cpu 17.994 total
( ps aux | grep 'ruby-debugger' | grep -v grep | head -n 1 | sed  | cut -f 2 )  0.02s user 0.09s system 49% cpu 0.222 total

But maybe there's an edge case I'm not thinking of.

17 seconds is quite a bit better than I'm getting on my big quad at work, oddly.

astashov commented 13 years ago

That's so strange!

time ( lsof -i tcp:39768 | grep LISTEN | awk '{print $2}'; )
real    0m0.022s
user    0m0.005s
sys 0m0.014s
stephenprater commented 13 years ago

I'd say it seems like PPC thing, but I tried it on an intel and had the same kind of results.