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

Refactor test motion #15

Merged
merged 2 commits into from
Jan 7, 2024
Merged

Conversation

pcbeard
Copy link
Contributor

@pcbeard pcbeard commented Jan 6, 2024

Cache allocations of params and test_motion_result

Instead of allocating these on each call to _physics_process(),
allocate once using @onready variables.

Also refactor calls to PhysicsServer3D.body_test_motion() to call
a helper function, test_motion() to make the code smaller.

Instead of allocating these on each call to _physics_process(),
allocate once using @onready variables.

Also refactor calls to PhysicsServer3D.body_test_motion() to call
a helper function, test_motion() to make the code smaller.
@pcbeard
Copy link
Contributor Author

pcbeard commented Jan 6, 2024

Here's a performance trace taken with these changes:

refactor_test_motion

Copy link
Owner

@Phazorknight Phazorknight left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, thanks for these tweaks.

@Phazorknight Phazorknight merged commit 8b0315e into Phazorknight:main Jan 7, 2024
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