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

new: optimize VoxelShapes.matchesAnywhere using simplicity of cuboid shapes #148

Merged

Conversation

2No2Name
Copy link
Member

This PR avoids the allocations in VoxelShapes.matchesAnywhere (PairLists and lambdas) in cases where it is called with at least one cuboid shape as argument. If both arguments are cuboid shapes the collision calculation is very simple.
The correctness was tested by randomly trying out millions of collisions.
Performance testing still needs to be done

@2No2Name 2No2Name force-pushed the 1.16.x/pull/fast_matchesAnywhere branch from 443cc15 to 886d27d Compare November 26, 2020 06:08
@2No2Name
Copy link
Member Author

Profiling showed about 50% lower runtime in a test setup that contains both collisions between two cuboids, and between cuboids and more complex shapes. (Setup: took the Test class and only ran the vanilla, and then only ran the modded code (with vanilla fallback), result: runtime is 50% lower when running modded code)

@2No2Name 2No2Name merged commit 5b10b9c into CaffeineMC:1.16.x/dev Nov 26, 2020
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.

1 participant