-
Notifications
You must be signed in to change notification settings - Fork 26
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Extreme slowdown withing Love2d / breakpoints ignored #59
Comments
Unfortunately, debugging with breakpoints on will always be slower due to the need for maintaining a line-based hook (basically, every line that's executed needs to be checked if it's a breakpoint). Some work has gone into optimizing this in recent versions, but if it's still too slow there may not be much more that can be done. |
that I can understand- thing is, it is something like a 120x slowdown - I cannot understand how my code (?) would trigger that (it works at full speed without debug attached) |
That does seem excessive. If you have anything you'd be willing to share I can take a look at it. It's possible some bug is being triggered by a combination of things. |
My application also runs much, MUCH slower while debugging. As it turns out, half of the time, it is running the debugger and not my application. As op I am using löve2d. local value1 = ...
return value1 == "foo" So that input parameters can be mapped by lua, which is much, much faster. |
What tools are you using to create these LuaJIT flame graphs? |
Yeah - conditional breakpoints were one area I haven't put serious effort into optimizing yet (wasn't sure how frequently they were actually used by folks). For regular breakpoints, I'm not sure there's much room for significant gains unless a new strategy is used altogether. Simply having the line-based hook is a huge slowdown, so if there's any chance for a notable speedup, it's going to involve somehow not using that. A theoretical improvement could be using a function-based hook and switching to a line-based hook only when inside of a function that contains a breakpoint. This increases complexity quite a bit and the possible performance gains are dependent on the structure of the code being debugged, but it might be worth experimenting with. |
Conditional breakpoints are quite usefull, especially if code is executed frequently. They are much easier to setup than change the code (e.g. an if) and restart the debugger with a line breakpoint. @stuta basicly I dump stacktraces using luajits profiler, which is now bundled in löve2d 11.4 if you are on Linux or Windows. Mac I am not sure, last time i checked, mac only supported 5.1. Once dumped (and in the correct format), you can feed it into flamegraph, which will output svgs. You can view these in any modern browser (e.g. firefox/chrome). To dump the stacktraces, I modified this gist, to suit my needs. The readme of flamegraph doesn't really explain the format though, so look into flamegraph.pl , which has a nice header comment explaining everything, including the fomat (line based stacktraces, seperated by semicolons and a sample count in the end). |
Thanks for the profilier info! |
For anyone interested: I created a sample based profiler for lua over here. |
Symptoms
Setting any breakpoints makes the application (Love2d game) extremely slow (but breakpoints are working).
Removing/disabling breakpoints before starting a debug session fixes the slowdown, but breakpoints are ignored.
Deleted workspaceCache did not fix the issue
Note: debug used to work for that project - might be application code related
Environment
Windows 10
Love2d 11.4
VSCode
Version: 1.65.2 (system setup)
Commit: c722ca6c7eed3d7987c0d5c3df5c45f6b15e77d1
Date: 2022-03-10T14:34:03.833Z (3 wks ago)
Electron: 13.5.2
Chromium: 91.0.4472.164
Node.js: 14.16.0
V8: 9.1.269.39-electron.0
OS: Windows_NT ia32 10.0.19043
The text was updated successfully, but these errors were encountered: