Skip to content

Refactor: NewtonianParticleInfluencer reduce object allocations - #2506

Merged
yaRnMcDonuts merged 1 commit into
jMonkeyEngine:masterfrom
capdevon:capdevon-NewtonianParticleInfluencer
Sep 7, 2025
Merged

Refactor: NewtonianParticleInfluencer reduce object allocations#2506
yaRnMcDonuts merged 1 commit into
jMonkeyEngine:masterfrom
capdevon:capdevon-NewtonianParticleInfluencer

Conversation

@capdevon

@capdevon capdevon commented Jun 19, 2025

Copy link
Copy Markdown
Contributor

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
@codex128 codex128 added the Refactoring and Cleanup This PR is all about improving code quality and javadoc. label Aug 30, 2025
@yaRnMcDonuts
yaRnMcDonuts merged commit 8cc3086 into jMonkeyEngine:master Sep 7, 2025
@capdevon
capdevon deleted the capdevon-NewtonianParticleInfluencer branch September 14, 2025 10:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Refactoring and Cleanup This PR is all about improving code quality and javadoc.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants