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 Memory<T>.ToArray() calls from Scene class #3

Merged
merged 1 commit into from
Jun 24, 2022

Conversation

an-prata
Copy link
Owner

Removes Memory<T>.ToArray() calls from the Scene class and replaces the use of IMemoryOwner with GCHandle instances. vertexHandle and elementHandle are now assigned values in construction while the class still has access to the vertexData and elementData arrays.

To do this vertexMemory and elementMemory are now constructed with the aforementioned arrays rather than getting an IMemoryOwner from MemoryPool<T>.Shared.Rent(), then copying the array to its IMemoryOwner.Memory property.

@an-prata an-prata self-assigned this Jun 24, 2022
@an-prata an-prata added the rework Rewrite to existing features to improve performance, maintainability, or consistency label Jun 24, 2022
@an-prata an-prata linked an issue Jun 24, 2022 that may be closed by this pull request
@an-prata an-prata merged commit 261c19e into main Jun 24, 2022
@an-prata an-prata deleted the an-prata/remove-duplicate-memory branch June 24, 2022 21:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
rework Rewrite to existing features to improve performance, maintainability, or consistency
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Avoid use of Memory<T>.ToArray() as it copies rather than references memory
1 participant