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

Improve sphere heap usage #4113

Merged
merged 4 commits into from
Mar 13, 2024
Merged

Conversation

Mag-nus
Copy link
Member

@Mag-nus Mag-nus commented Feb 18, 2024

Pass Center and Radius to static functions as parameters instead of instantiating a new Sphere on the heap and passing that through the code.

Reference: https://learn.microsoft.com/en-us/dotnet/csharp/advanced-topics/performance/

This is built on top of the improve stack PR.

Several of the functions in Sphere take parameters that were not used.
This PR creates overloads that retain the existing signatures, marks them obsolete, and removes the unused parameters from the core function.

GetHashCode is optimized

FindTimeOfCollision is marked Static
Pass Center and Radius to static functions as parameters instead of instantiating a new Sphere on the heap and passing that through the code.

Reference: https://learn.microsoft.com/en-us/dotnet/csharp/advanced-topics/performance/
@Mag-nus
Copy link
Member Author

Mag-nus commented Feb 18, 2024

This also keeps the existing public API in tact

@Mag-nus Mag-nus changed the title Improve sphere heap Improve sphere heap usage Feb 18, 2024
LtRipley36706
LtRipley36706 previously approved these changes Mar 12, 2024
@Mag-nus Mag-nus merged commit 2f30b58 into ACEmulator:master Mar 13, 2024
2 checks passed
@Mag-nus Mag-nus deleted the ImproveSphereHeap branch March 13, 2024 02:54
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.

None yet

2 participants