summaryrefslogtreecommitdiffstats
path: root/modules/gdscript/gdscript.h
diff options
context:
space:
mode:
authoreldidou <thedidou@gmail.com>2023-12-01 12:32:25 +0100
committereldidou <thedidou@gmail.com>2023-12-09 13:02:38 +0100
commit0d77c3e09228b847658de3453b36fa78e073222c (patch)
tree596b66f09a19be8526e065b41f07d1717164d609 /modules/gdscript/gdscript.h
parentb94eb58d35b3dd8a9f522bc90df0db73862ef326 (diff)
downloadredot-engine-0d77c3e09228b847658de3453b36fa78e073222c.tar.gz
Speed up GDScript::get_must_clear_dependencies()
get_must_clear_dependencies() has a N^3*log(N) time complexity, and this can very quickly slow down the quitting process as more gdscripts are added in a project. This change improves it to N^2*log(N). Instead of using all the inverted dependencies, we do the same with all (non-inverted) dependencies, which is N times faster. Fixes #85435
Diffstat (limited to 'modules/gdscript/gdscript.h')
-rw-r--r--modules/gdscript/gdscript.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/modules/gdscript/gdscript.h b/modules/gdscript/gdscript.h
index aba4d7e721..5165ec1b06 100644
--- a/modules/gdscript/gdscript.h
+++ b/modules/gdscript/gdscript.h
@@ -254,7 +254,7 @@ public:
const Ref<GDScriptNativeClass> &get_native() const { return native; }
RBSet<GDScript *> get_dependencies();
- RBSet<GDScript *> get_inverted_dependencies();
+ HashMap<GDScript *, RBSet<GDScript *>> get_all_dependencies();
RBSet<GDScript *> get_must_clear_dependencies();
virtual bool has_script_signal(const StringName &p_signal) const override;