New performance patch : FasterEditorPartList #326
Merged
Merged
Conversation
Improve the responsiveness of the part list when switching between categories, sorting and searching by tag.
Specifically, the cache for a part willbe cleared/rebuilt if the original AvailablePart.tags string is changed. This shouldn't happen in a stock game, but it is possible for mods to alter tags after loading.
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.
Address issue #242
Improve the responsiveness of the part list when switching between categories, sorting and searching by tag.
The part list implements a caching mechanism to avoid re-instantiating already generated icons, which avoid the bulk of the cost of swapping the shown parts in the part list. Once all icons were generated at least once, it just re-parent them between a disabled
partIconStorageGameObject and the scrollview GameObject.Profiling show that roughly 70-80% of the time is spent doing this reparenting, which we avoid by :
partIconStoragein the EditorPartList.ClearAllItems() method (by removing the SetParent call)Doing this cause two issues :
We fix that by altering
EditorPartList.UpdatePartIcons()in two ways :Note that we do both before the call to
EditorPartList.UpdatePartIcon(), as VABOrganizer is postfixing it and is relying on the icons being in their right place within the scrollview at this time.Additionally, this implement a caching mechanism storing pre-parsed tags for each
AvailablePart, preventing the overhead of having to parse to the tokenizedAvailablePart.tagsstring every time filtering is needed. There are typically 15+ tags per part, so this has a very significant impact.These changes significantly improve overall responsiveness of the part list updates when switching between categories, changing the sorting type/order or using tag search.