Skip to content

Remove CustomUpdateData heap allocation in OnUpdate hot path.#403

Merged
DarthAffe merged 2 commits intoDarthAffe:Developmentfrom
stonstad:Contributions
Nov 3, 2024
Merged

Remove CustomUpdateData heap allocation in OnUpdate hot path.#403
DarthAffe merged 2 commits intoDarthAffe:Developmentfrom
stonstad:Contributions

Conversation

@stonstad
Copy link
Contributor

@stonstad stonstad commented Oct 12, 2024

This change removes heap allocation of CustomUpdateData in the OnUpdate hot path when custom data does not exist. A read-only CustomUpdateData.Empty property is added to reuse a default instance and remove a per-update allocation.

…ustomUpdateData.Empty property.

Remove CustomUpdateData heap allocation in OnUpdate hot path. Added CustomUpdateData.Empty property.
@DarthAffe
Copy link
Owner

DarthAffe commented Oct 13, 2024

Ah, that's a nice catch - my first thought seeing this was, that there are actually no places where this is relevant, but the DeviceUpdateTriggers call this.

Just a small suggestion to get around warnings regarding the naming convention.

Co-authored-by: DarthAffe <darthaffe@wyrez.org>
@DarthAffe DarthAffe merged commit 71f1115 into DarthAffe:Development Nov 3, 2024
@stonstad stonstad deleted the Contributions branch November 12, 2024 16:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants