Skip to content

Improvement on Code to reduce memory allocations #676

@TheMasterofBlubb

Description

@TheMasterofBlubb

Describe the request

Hi, I'm currently on the go and randomly found this project.

When looking through the code out of interes I found the following line:

this.transformed[i1] = new Vector3f(0.0f);

Is there a specific reason to not use Vector3f.zero()?

The initial array should be already initialized to 0 on first creation of the parent object, but currently the array is initialized at least twice, once on parent object creation and a second time in the loop.

This would remove multiple memory allocations in a seemingly often used part of code, reducing GC load in the process.

Should be a small change with some minor performance improvements.

If I don't forget I can make a small PR, though I don't have the tools installed to test it

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions