Miscellaneous editor optimizations for large scenes#109513
Merged
Repiteo merged 1 commit intogodotengine:masterfrom Sep 20, 2025
Merged
Miscellaneous editor optimizations for large scenes#109513Repiteo merged 1 commit intogodotengine:masterfrom
Repiteo merged 1 commit intogodotengine:masterfrom
Conversation
KoBeWi
reviewed
Aug 22, 2025
KoBeWi
reviewed
Aug 22, 2025
8ab4086 to
ae56dfa
Compare
KoBeWi
reviewed
Aug 23, 2025
KoBeWi
approved these changes
Aug 23, 2025
ae56dfa to
e73e978
Compare
Contributor
|
Thanks! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
There were a few miscellaneous changes that didn't fit thematically into the other optimization PRs, so I've grouped them here.
editor_node.cpptransform flushingThe
editor_node.cppchange is necessary because some editor plugins expect the transforms to be properly set up during the_load_editor_plugin_states_from_configcall later.As a concrete example of an issue, open the
Mesh3DInstance25k.tscnfile. Opening it takes ages because of a convoluted path that triggers an issue in theDynamicBVHcode. Because the instances all have the same local coordinates, they're initially loaded with identical transforms. They're added to the occlusion culler's dirty instance list, and then during the plugin setup something isfreedfrom the culler, causing the dirty list to get processed. However, the transforms have never been propagated between scene loading and now, so everything is inserted at the same location. This triggers anO(n^2)edge case in the BVH.I wouldn't have noticed this issue without it triggering a separate bug. However, both the official plugins and one user plugin end up doing twice as much setup work as they should, because they process the state of the world during the plugin, and then get all the transform updates later. Setting up the transforms properly first seems like the correct thing to be doing, anyways.
Here's an example of a user plugin running into this issue.
I'm not sure this is exactly the right place to put the
flush_transform_notificationscall, it could also be put insideset_edited_scene, but I erred on the side of the least impactful change.canvas_item_editor_pluginEDITOR_GET removalWhen I profiled the delay when selecting canvas items in the editor, literally 60% of the time was spent on this single
EDITOR_GETcall, so I cached it. The delay in question is small, but enough that it felt laggy to me, so I looked into where the time was being spent and found this._node_visibility_changedcache usePerhaps there's a good reason not to do this, but I couldn't find any issues when testing it. It does dramatically improve the time to update the visibility of large numbers of objects at once.
Sprite2D25k.tscnOn
master, step 3 alone takes ~50 seconds. With this PR, it takes about a half a second.If you want to test this particular speedup yourself, it'll likely be difficult without also applying #109515 so that large selections are less problematic.
All performance tests were run on builds made with the following command:
scons optimize=speed_trace debug_symbols=yes platform=linuxbsd dev_build=no production=yes.The test project editor-optimization-test-scenes.zip consists of a series of scenes that each have 25,000 of a common type of node.