You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There are many class/struct member variables that can be moved to an initializer to avoid creating objects twice.
The performance enhancement of doing this is negligible for primitive types and for compilers that already do this optimization by default (like GCC), but a performance improvement might be noticeable on compilers that do not do this since on some cases, generally speaking, creating non-primitive objects twice could hurt performance.
Edit: As a clarification -- there's a chance the performance enhancement of using an initializer list is already being done by the compiler in a certain optimization pass, and given the sheer amount of changes in the master branch, I don't think this is worth looking into. It's more important to keep an eye on uninitialized variables that could cause issues, which is what this issue implicitly tracks, but it's explicitly tracked by the aforementioned issue.
Perhaps it might be worth looking into non-primitive types into an initializer list after 4.0 is released, but not before, and even then it's only worth looking into if the construction of non-primitive types actually hurt performance in certain areas.
Godot version:
master branch commit 41d1dba
Issue description:
There are many class/struct member variables that can be moved to an initializer to avoid creating objects twice.
The performance enhancement of doing this is negligible for primitive types and for compilers that already do this optimization by default (like GCC), but a performance improvement might be noticeable on compilers that do not do this since on some cases, generally speaking, creating non-primitive objects twice could hurt performance.
Here's a list of the member variables that can be moved. This file does not include the variables I moved in #24241. It's an easy patch for anyone who'd like to contribute.
Steps to reproduce:
To generate attached list in linux you must have
cppcheck
installed. Then:The text was updated successfully, but these errors were encountered: