-
Notifications
You must be signed in to change notification settings - Fork 111
Reduce memory allocations where convenient #120
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
Conversation
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.
Pull Request Overview
This PR optimizes IMGUI rendering performance by reducing GC allocations through pre-allocated layout option arrays and moving expensive filtering operations to the Update loop instead of OnGUI. The changes improve runtime performance without affecting functionality.
- Pre-allocated GUILayoutOption arrays to avoid per-frame allocations in OnGUI
- Moved Inspector entry filtering from OnGUI (DrawContentScrollView) to Update loop to reduce GC pressure
- Added component GUIContent caching in ObjectTreeViewer to reduce allocations
- Converted foreach loops to for loops in hot paths
Reviewed Changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 11 comments.
Show a summary per file
| File | Description |
|---|---|
| RuntimeUnityEditor.Core/Windows/Taskbar.cs | Introduced pre-allocated layout option arrays and moved title generation to Enabled property setter |
| RuntimeUnityEditor.Core/Windows/ObjectTree/RootGameObjectSearcher.cs | Made search member blacklist static readonly and moved filtering logic before LINQ chains |
| RuntimeUnityEditor.Core/Windows/ObjectTree/ObjectTreeViewer.cs | Added component name GUIContent caching and pre-allocated layout option arrays |
| RuntimeUnityEditor.Core/Windows/Inspector/VariableFieldDrawer.cs | Applied EmptyLayoutOptions to various GUILayout calls |
| RuntimeUnityEditor.Core/Windows/Inspector/Inspector.cs | Moved entry filtering from DrawContentScrollView to Update method, reducing OnGUI GC allocations |
| RuntimeUnityEditor.Core/Windows/Inspector/Inspector.InspectorTab.cs | Removed unused imports |
| RuntimeUnityEditor.Core/Utils/IMGUIUtils.cs | Added EmptyLayoutOptions and LayoutOptionsNoExpansion constants |
| RuntimeUnityEditor.Core/Utils/Abstractions/GUILayoutShim.cs | Added XML documentation comments |
| RuntimeUnityEditor.Bepin5/PatchInspector/PatchInspector.cs | Applied EmptyLayoutOptions to GUILayout calls |
| RuntimeUnityEditor.Bepin5/PatchInspector/ILViewerWindow.cs | Applied EmptyLayoutOptions to GUILayout calls |
| RuntimeUnityEditor.Bepin5/LogViewer/LogViewerWindow.cs | Applied EmptyLayoutOptions to GUILayout calls |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
No description provided.