mirror of
https://github.com/DarthAffe/RGB.NET.git
synced 2026-11-11 21:16:24 +00:00
Merge pull request #403 from stonstad/Contributions
Remove CustomUpdateData heap allocation in OnUpdate hot path.
This commit is contained in:
2 files changed
+5
-2
No files matched your search
@@ -29,13 +29,13 @@ public abstract class AbstractUpdateTrigger : AbstractBindable, IUpdateTrigger
|
||||
/// Invokes the <see cref="Starting"/>-event.
|
||||
/// </summary>
|
||||
/// <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>
|
||||
/// Invokes the <see cref="Update"/>-event.
|
||||
/// </summary>
|
||||
/// <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 />
|
||||
public abstract void Start();
|
||||
|
||||
@@ -52,6 +52,9 @@ public sealed class CustomUpdateData : ICustomUpdateData
|
||||
{
|
||||
#region Properties & Fields
|
||||
|
||||
// ReSharper disable once InconsistentNaming
|
||||
public static readonly CustomUpdateData Empty = new();
|
||||
|
||||
private readonly Dictionary<string, object?> _data = [];
|
||||
|
||||
#endregion
|
||||
|
||||
Reference in new issue
Block a user