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

Inline default math type constructors #74

Merged
merged 1 commit into from
Jul 31, 2020
Merged

Conversation

AustinEast
Copy link
Contributor

This PR just adds inline to all the default math type constructors. This will allow the Haxe compiler to reduce allocations on local variables, which has huge performance implications for game projects that use lots of math functions every frame.

As a test case, I used this branch on my physics library echo, which uses hxmath classes throughout its codebase. It nearly got rid of all my allocations, and drastically improved performance on Hashlink (over 2x!), which was previously getting hit pretty hard by garbage collection.

If you're interested, here is some more info on inlined constructors: https://haxe.org/manual/lf-inline-constructor.html

@tbrosman
Copy link
Owner

Ah, I've been meaning to do this for a while. Looks good to me!

@tbrosman tbrosman merged commit dbc87e2 into tbrosman:master Jul 31, 2020
@skial skial mentioned this pull request Aug 3, 2020
1 task
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