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:
@@ -2,8 +2,8 @@ using System;
|
||||
|
||||
namespace Syntriax.Engine.Core;
|
||||
|
||||
public record EngineTime
|
||||
(
|
||||
TimeSpan Total,
|
||||
TimeSpan Elapsed
|
||||
);
|
||||
public readonly struct EngineTime(TimeSpan Total, TimeSpan Elapsed)
|
||||
{
|
||||
public readonly TimeSpan Total { get; init; } = Total;
|
||||
public readonly TimeSpan Elapsed { get; init; } = Elapsed;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user