Skip to content

Refactor: NewtonianParticleInfluencer reduce object allocations #2506

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

capdevon
Copy link
Contributor

@capdevon capdevon commented Jun 19, 2025

The proposed modification to the NewtonianParticleInfluencer.java file optimizes how temporary matrix objects are handled during particle tangent rotation calculations. In the original version, a new Matrix3f object was created inside a frequently executed code block, which could lead to unnecessary object creation and increased memory usage.

The modified version introduces a reusable Matrix3f instance (tempMat3) as a class field, eliminating repeated allocations. This change improves performance and memory efficiency by reusing the same matrix object during tangent rotation computations.

@yaRnMcDonuts yaRnMcDonuts added this to the v3.9.0 milestone Jun 19, 2025
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