-
-
Notifications
You must be signed in to change notification settings - Fork 21.4k
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
Fix performance issue reimport file reload scene #95225
Fix performance issue reimport file reload scene #95225
Conversation
See #94648. |
Thanks so much for working on this @Hilderin, you're once again saving the 4.3 release 🥇 I'll try to give this a quick test and superficial review, and aim to merge it today so I can release |
Modifying all Current
Current Seems pretty drastic! I've also done a cursory review of the code, looks fine to me overall, but I'm no expert in this part of the engine. |
I have tested this PR and confirm that it fixes the performance and brings things in line with expectations (3+ minutes down to 7 seconds). On my device, initial import of the entire project is about 45 seconds (25 seconds to import + 20 seconds to open the scene). On master re-importing a single mesh took 3+ minutes and with this PR the one i tested took 7 seconds. |
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.
Approving based on my above test and quick review.
Clay also mentioned having very good results with the MRP and an optimized build.
Thanks! Amazing work once again 🎉 |
Thanks!! Unfortunately, I found a problem in this PR when multiple files are reimported at the same time. I created a small PR to fix that: #95264 |
This PR should significantly improve performance when reimporting assets with the auto-reload of scenes.
What has been done:
EditorNode::preload_reimporting_with_path_in_edited_scenes
: It takes 7-8 seconds on my PC just to remove and re-add the scene. This part should not require the scene to be in the tree to load the modified properties and nodes to reimport. I had to modifyEditorNode::get_preload_scene_modification_table
to useget_transform
instead ofget_relative_transform
. I don't know whyget_relative_transform
was used, but in my tests, it works fine withget_transform
. Additionally, when the transform is restored, it usesset_transform
.EditorNode::reload_instances_with_path_in_edited_scenes
: The addition and removal of the reloaded scene have been minimized. The current edited scene should almost never be removed unless another scene that needs to be reloaded has the same name.EditorNode::_set_current_scene_nocheck
: The addition and removal of the reloaded scene have been removed if the same scene is reloaded.EditorNode::update_node_reference_modification_table_for_node
: This method has been replaced byEditorNode::get_preload_modifications_reference_to_nodes
, which now runs in the preload and loads only modified properties that reference reimported nodes. Previously, it loaded every property modification in the scene, taking about 10 seconds. Now, it takes around 7 seconds in debug mode. The main issue was the call top_node->get_property_list
for each node in the scene. I have not found a better solution to optimize this.Tested
Known issues
Node3DEditor::_request_gizmo
removes 15 seconds from the startup time.editor_description_changed
not disconnected on SceneTreeDock refresh #95221 for signals that never disconnect and accumulate on nodes.add_child
andremove_child
.I will not work on these issues for now, as I think the current performance of this PR is acceptable.
Time
Reloading an asset in the MRP (debug dev build):
Reloading an asset in the MRP (prod build):
With the artifact from the PR:
godot.windows.editor.x86_64_LIsqklfJDn.mp4