Skip to content

New performance patch : FasterEditorPartList #326

Merged
gotmachine merged 3 commits into
devfrom
FasterEditorTagSearch
Aug 28, 2025
Merged

New performance patch : FasterEditorPartList #326
gotmachine merged 3 commits into
devfrom
FasterEditorTagSearch

Conversation

@gotmachine
Copy link
Copy Markdown
Contributor

@gotmachine gotmachine commented Jul 10, 2025

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 partIconStorage GameObject and the scrollview GameObject.

Profiling show that roughly 70-80% of the time is spent doing this reparenting, which we avoid by :

  • Preventing the icon objects from being parented to the partIconStorage in the EditorPartList.ClearAllItems() method (by removing the SetParent call)
  • Preventing the icon objects from being parented back to the scrollview in the EditorPartList.UpdatePartIcon() method (by removing the SetParent call)

Doing this cause two issues :

  • It prevent the icon object from ever being parented to the scrollist, so they never appear
  • The icons are not ordered anymore according to the sorting filter, as this was done by unparenting / reparenting them

We fix that by altering EditorPartList.UpdatePartIcons() in two ways :

  • We call SetParent for newly instantiated icons so they are parented to the scrollview
  • We set the already instantiated icons that are about to be re-activated to be the last sibling to respect the requested sorting.

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 tokenized AvailablePart.tags string 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.

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.
@gotmachine gotmachine merged commit 8bfec76 into dev Aug 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant