rubyide / vscode-ruby

Provides Ruby language and debugging support for Visual Studio Code
https://marketplace.visualstudio.com/items?itemName=rebornix.Ruby
MIT License
1.26k stars 285 forks source link

Slow process on debug. WEBrick #92

Closed laerciocrestani closed 6 years ago

laerciocrestani commented 7 years ago

Your environment

Make sure you have ruby, ruby-debug-ide and ruby-debug-basex19 installed before submitting your issue -- thank you !

Hello. I'm debugging via RailsServer (WEBrick) via console in vscode.

Page Transition,

I noticed a slowness of more than double the time debugging by vscode, running sim simple page load. In the traditional "rails s" form inside the terminal I have a much larger performace. Has anyone gone through this?

HookyQR commented 7 years ago

The debugger certainly does slow down your process. In order to provide the debug information for the running process it adds a hook on EVERY executed step. This generally means every line of code, and every method call, and every return from a method (or block) gets extra code run around it. So how much it slows your process by is dependant on the structure of the executing code. Rails does a lot of stuff for every call, so in your case you're being slowed because of the way rails works.

laerciocrestani commented 7 years ago

Okay. Is there anything I can do, maybe use another debugger? Or is it normal in this way?

HookyQR commented 7 years ago

Using a byebug drop in will give you the best run speed before the call gets hit, but after that you'll get much the same result. There's no graphical interface though, so you won't get the simplicity of using the debugger in VS Code. Debugging is slow in ruby.

AndrewRayCode commented 7 years ago

A little more context to this:

On a fairly large Rails codebase, if I add a binding.pry and run rspec from the vanilla terminal, it takes 24 seconds to reach the breakpoint. Not super duper already, but...

With vscode-ruby, debugging through Visual Studio Code, same command, it takes 1 minute and 49 seconds to reach the breakpoint. There isn't any output from the RSpec test at all until 1:30.

I would prefer to debug through my IDE if possible, because it's generally a nicer environment. However, there's not really a point if I have to wait over a minute to get to a breakpoint. Terminal debugging isn't ideal but it's currently so much faster than vscode-ruby that in most cases I could debug and solve the problem before vscode-ruby even gets to the breakpoint.

Are there any specific tricks to speed this up? Could behavior be improved to not add debugging wrappers around every single line, and only start debugging at breakpoints? Right now there's no point to using this workflow on large codebases.

HookyQR commented 7 years ago

There's no way to speed it up as it stands at the moment. The bindings build from start, which is the reason for the speed difference.

AndrewRayCode commented 7 years ago

Is this an inherent limitation of the ruby-debug-ide gem? To this project's credit, I ran the same debugging task in RubyMine (I've found JetBrains software to be very well optimized), which also uses ruby-debug-ide to start the debugger, and hitting the first breakpoint took about the same time.

HookyQR commented 7 years ago

It's ruby-debug-ide. Again it's to do with when the debugger starts binding.

AndrewRayCode commented 7 years ago

For future reference https://github.com/ruby-debug/ruby-debug-ide/issues/91

wingrunr21 commented 6 years ago

Closing for issue cleanup. Apologies if this is still an issue. We are working to improve the core extension experience.