Syntriax f5a7077570 perf: improved garbage created by tweens slightly
They still do generate a lot of garbage but with boxed value pools I made the boxes reusable, it still does generate garbage through the delegate creation, gotta find a solution for them later
2025-08-14 20:31:46 +03:00

15 lines
407 B
C#

using Engine.Core;
namespace Engine.Systems.Tween;
public class BoxedPool<T>(int initialCapacity = 1) : Pool<Boxed<T>>(() => new(), initialCapacity) where T : struct;
public static class BoxedPoolExtensions
{
public static Boxed<T> Get<T>(this BoxedPool<T> boxedPool, T value) where T : struct
{
Boxed<T> boxed = boxedPool.Get();
boxed.Value = value;
return boxed;
}
}