Mitigate auto completion stuttering using threads #7487
Replies: 3 comments 1 reply
-
I'm surprised autocompletion is that slow on your CPU. Are you using an official editor build or a self-compiled build? If using a self-compiled build, make sure to use
This will be possible in 4.2: godotengine/godot#68140 |
Beta Was this translation helpful? Give feedback.
-
To be more precise, there's a stall for a moment before the little suggestion box pops up. Once the suggestion box is there it seems to update more quickly. When the code complete delay is small enough however, that stall happens constantly while typing even if the suggestion box stays up the whole time. It's very similar to the stall that I get when idle parsing happens and both mess up input events. Maybe it would be helpful if I figure out how to profile the editor and post some results? |
Beta Was this translation helpful? Give feedback.
-
I've been doing some more digging and have come to the conclusion it's probably some kind of call to script validation or parsing that is actually causing the stall, not the auto complete suggestion box or maybe even the autocomplete logic. There are some scripts that cause major stalling when changing Editor Settings while they're open and these same scripts are the ones in which auto completion stalls. The common thread of these laggy scripts is that they reference variables in my largest "content" file. The content file is a "large" (~1200 lines) auto-load file that contains variables to be used throughout the game like player base stats or the shapes / textures of enemies. As files reference this ( Godot_v4.1-stable_win64_2023-08-14_10-37-41.mp4The stalling seems to be coming from the same source which I'm making the assumption is _validate_scripts, but I can't find proof that it's being called when EditorSettings change, so maybe not. So not specifically auto-complete related I suppose. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
EDIT: I've compiled more information and opened an issue for this. godotengine/godot#80637
Auto completion is very useful and saves a lot of time when it works correctly, but it's so slow in Godot v4.1.stable.official [970459615] that I've just made the delay as long as possible (5 seconds; can't disable it I think?) so I can activate it manually (ctrl + space) when applicable.
Here are some visual examples with completion delay set to 0.01 to force it to happen, though it's not very easy to see exactly how sluggish it is. The CPU usage is only one of sixteen cores (i7-10700K) so it almost maxes out one core just to do the auto completion. My fans even start up.
Examples
Godot_v4.1-stable_win64_2023-08-12_15-20-58.mp4
Godot_v4.1-stable_win64_2023-08-12_15-25-50.mp4
The obvious suggestion is to set the delay to something more reasonable like the default of 0.3 seconds but then I have to wait the duration to prevent the menu from interrupting my next key press (like changing lines with the arrow keys) since pressing escape only dismisses it once it's up, it doesn't cancel it. Making it longer to give me time to press the arrows keys consistently also makes it less useful because then I sit there waiting for it to activate or have to press ctrl + space to activate it myself anyway.
If it were just always going on the background I could type and watch it until it suggested what I want and grab it. VSCode's is snappy enough to be used like this.
There are two clear ways to address this issue:
I'm of course making the assumption here that threading it is easier than "just make it faster." Maybe that's misguided.
Beta Was this translation helpful? Give feedback.
All reactions