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:
2024-01-26 23:40:02 +03:00
parent c32add40ff
commit b14d10db0c
15 changed files with 88 additions and 49 deletions

View File

@@ -1,6 +1,10 @@
using Syntriax.Engine.Physics2D.Abstract;
namespace Syntriax.Engine.Physics2D;
public record PhysicsMaterial2DDefault : PhysicsMaterial2D
public readonly struct PhysicsMaterial2DDefault : IPhysicsMaterial2D
{
public PhysicsMaterial2DDefault() : base(.1f, .1f) { }
public readonly float Friction => .1f;
public readonly float Restitution => .1f;
}