Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove CustomUpdateData heap allocation in OnUpdate hot path. #403

Merged
merged 2 commits into from
Nov 3, 2024

Conversation

stonstad
Copy link

@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.

@DarthAffe DarthAffe merged commit 71f1115 into DarthAffe:Development Nov 3, 2024
1 check passed
@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