Download

make GetWorldFromContextObject static ( and why not forceinline )

Hi, I was wondering if there could be an easy win to make make GetWorldFromContextObject static and why not forceinline.

It’s probably one of the most called function in blueprint projects, most of gameplay static function call it, so it can add up pretty fast, user tend to think “GetGameMode” is free but it call the get context .

Why Static ? why do we need to de reference GEngine in the first place, this function doesn’t use/need it, perfect fit for static

why force inline ? it’s and often called function because of the way it’s used, but there isn’t that much actual places where it’s called ( thinking of assembly size ). And the way it work, it’s a pretty good spot for context specific optimizations by compiler

the most used path (LogAndReturnNull) has 2 log, to avoid inlining str’s they could be wraped in an other static function, the cases where the log is needed wouldn’t be slower than actual because of inlined main function

what do you think ? Do i miss the reason it’s not static / allready inlined today ?