Skip to content

Conversation

@FlaggAC
Copy link
Contributor

@FlaggAC FlaggAC commented Aug 11, 2024

Entire set of fields can be marked as readonly, as it never changes outside of the constructor.
Reduces unnecessary reflection operations by pre-fetching them during constructor
Changes WeenieObject to a sealed class to guarantee immutability
Immutability allows a shared DummyObject to be used by PhysicsObjs which do not have a weenie.

The reflection calls are made frequently by PhysicsObj.FindObjCollisions(Transition), which is a very frequently-called method, so this is expected to improve performance. The 'is' operator is fast by reflection standards, but there is still some overhead with it, which should not be ignored considering the high frequency of the method calls.

ID and UpdateTime are commented out because they are never used.

Entire set of fields can be marked as readonly, as it never changes outside of the constructor.

Reduces unnecessary reflection operations by pre-fetching them during constructor

Changes WeenieObject to a sealed class to guarantee immutability

Immutability allows a shared DummyObject to be used by PhysicsObjs which do not have a weenie.
@gmriggs gmriggs requested a review from Mag-nus August 11, 2024 07:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant