Performance Insights on UStruct vs UClass / Class

atanknomore
Sun, 26 Apr 2020 19:33:19 +0000
Editor Scripting

Hello,

I’d like some further information on how different Class types utilize information. First, I will state that I holster most of my information and logic handling inside UStructs at the moment, and implement them inside UObjects, so far staying within AActors and/or UActorcomponents.

I understand that FStructs’ instantiation takes fewer resources and allows for more flexible workflows (where data can be copied over and passed over the network). However, now looking into it, I find myself having over 250 UStruct Classes in my entire project (functionality covers an entire mid-large scale project). The reason for this is that I’ve stuck to a highly modular approach, where systems are approached from an open-PoV and are not environment conscripted (for example let’s say an Ability’s functionality only existing inside a specific actor/component. A lot of these classes are just Wrappers (handling Arrays of a given declared class) for more complex usages.

Having some context established, I now proceed to the point of the question: How is performance affected going from Class/UClass to UStruct? Is there much overhead given that the majority of the logic questions/ handling functions are declared inside said Structures? I do have to say that it does make working with them a breeze though.

While I have done network optimization on them, I’m now curious about whether I should put some (or most)? inside Classes (if not UClasses). Besides concept-knowledge (such as they’re not garbage collected), is there a significant tradeoff (CPU and ram wise) between them in real-time (other than class instantiation)?

1 post - 1 participant