-
-
Notifications
You must be signed in to change notification settings - Fork 21.5k
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
Emit filesystem_changed
only once per frame
#98584
Conversation
Doing this may introduce some unexpected regressions for plugins, as this signal is exposed and has been usable outside of internal code. Although this sounds desirable, it needs to be documented at least. Edit: I'm told this signal is already deferred. |
Pretty interesting, can’t test rn as i am way too busy, but it could work atleast for ram as my system just has 8gb of ram. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks fine. Usually we have a dedicated method for this pattern, e.g. queue_redraw()
works like that (i.e. it does a deferred call once per frame). Maybe it's worth applying it for other uses of the filesystem_changed
signal? But for now this will suffice.
df2dca7
to
01d1f10
Compare
This reminds me on a proposal I saw one time. It proposed to have a way to 'batch' signal emits so that everything that connects to that signal is executed just once per frame. |
We may be talking about the same thing. A long time ago there was a proposal (or PR?) for a signal connection flag to defer a single call, regardless of how many times the signal was emitted (behavior similar to |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wow great find and the improvements on import time is amazing.
Fantastic work! Thank you! |
…gnal Emit `filesystem_changed` only once per frame
This PR makes it so that only one deferred signal is emitted instead of dozens for each updated file. This was done in order to avoid unnecessary
FileSystemDock::update_all
, which was writing millions of items to theEditorResourcePreview
godot/editor/filesystem_dock.cpp
Lines 338 to 341 in 61accf0
and creating huge memory usage.
Tested on MRP from #97610.
Before that, it used 9GB of RAM.
Now it use 1GB.
Also, the import time improved 2-3 times.
Closes #97610
Edit: Does not help #95979