mirror of
https://github.com/DarthAffe/RGB.NET.git
synced 2025-12-13 01:58:30 +00:00
Remove CustomUpdateData heap allocation in OnUpdate hot path. Added CustomUpdateData.Empty property.
Remove CustomUpdateData heap allocation in OnUpdate hot path. Added CustomUpdateData.Empty property.
This commit is contained in:
parent
2bf081d16e
commit
c34435b958
@ -29,13 +29,13 @@ public abstract class AbstractUpdateTrigger : AbstractBindable, IUpdateTrigger
|
|||||||
/// Invokes the <see cref="Starting"/>-event.
|
/// Invokes the <see cref="Starting"/>-event.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="updateData">Optional custom-data passed to the subscribers of the <see cref="Starting"/>.event.</param>
|
/// <param name="updateData">Optional custom-data passed to the subscribers of the <see cref="Starting"/>.event.</param>
|
||||||
protected virtual void OnStartup(CustomUpdateData? updateData = null) => Starting?.Invoke(this, updateData ?? new CustomUpdateData());
|
protected virtual void OnStartup(CustomUpdateData? updateData = null) => Starting?.Invoke(this, updateData ?? CustomUpdateData.Empty);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Invokes the <see cref="Update"/>-event.
|
/// Invokes the <see cref="Update"/>-event.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="updateData">Optional custom-data passed to the subscribers of the <see cref="Update"/>.event.</param>
|
/// <param name="updateData">Optional custom-data passed to the subscribers of the <see cref="Update"/>.event.</param>
|
||||||
protected virtual void OnUpdate(CustomUpdateData? updateData = null) => Update?.Invoke(this, updateData ?? new CustomUpdateData());
|
protected virtual void OnUpdate(CustomUpdateData? updateData = null) => Update?.Invoke(this, updateData ?? CustomUpdateData.Empty);
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public abstract void Start();
|
public abstract void Start();
|
||||||
|
|||||||
@ -51,6 +51,7 @@ public interface ICustomUpdateData
|
|||||||
public sealed class CustomUpdateData : ICustomUpdateData
|
public sealed class CustomUpdateData : ICustomUpdateData
|
||||||
{
|
{
|
||||||
#region Properties & Fields
|
#region Properties & Fields
|
||||||
|
public static readonly CustomUpdateData Empty = new CustomUpdateData();
|
||||||
|
|
||||||
private readonly Dictionary<string, object?> _data = [];
|
private readonly Dictionary<string, object?> _data = [];
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user