perf: Drastically Improved Memory Usage
TIL, records are not value types and are actually just reference types. So I was pretty much allocating from heap every time I used any of my data types (Like Vector2D). Needless to say, they are all now readonly structs as I originally intended them to be.
This commit is contained in:
@@ -3,10 +3,16 @@ using Syntriax.Engine.Physics2D.Abstract;
|
||||
|
||||
namespace Syntriax.Engine.Physics2D;
|
||||
|
||||
public record CollisionDetectionInformation
|
||||
public readonly struct CollisionDetectionInformation
|
||||
(
|
||||
ICollider2D Left,
|
||||
ICollider2D Right,
|
||||
Vector2D Normal,
|
||||
float Penetration
|
||||
);
|
||||
)
|
||||
{
|
||||
public ICollider2D Left { get; init; } = Left;
|
||||
public ICollider2D Right { get; init; } = Right;
|
||||
public Vector2D Normal { get; init; } = Normal;
|
||||
public float Penetration { get; init; } = Penetration;
|
||||
}
|
||||
|
Reference in New Issue
Block a user