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

Optimize Editor _init_grid() #92734

Merged
merged 1 commit into from
Aug 16, 2024

Conversation

lawnjelly
Copy link
Member

Use static LocalVectors instead of Vectors for temporaries.

Forward port of #92725

Notes

  • Not profiled this but it should be significantly faster like [3.x] Faster editor grid #92725 because it avoids COW machinery (moo 🐮 ) and excessive allocations (the temporary vectors are static and will re-use memory, and only the final conversion to Vectors should cause allocations).
  • The IDX indexing and bounds checking could also be avoided by using pointers, but I've left that alone for now as it slightly less safe to future bugs (anyone else feel free to change).

@lawnjelly lawnjelly added this to the 4.x milestone Jun 3, 2024
@lawnjelly lawnjelly requested a review from a team as a code owner June 3, 2024 18:13
Copy link
Member

@clayjohn clayjohn left a comment

Choose a reason for hiding this comment

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

Looks great! Fewer memory allocations is always welcome

@clayjohn clayjohn modified the milestones: 4.x, 4.4 Jun 12, 2024
Use static `LocalVectors` instead of `Vectors` for temporaries.
@lawnjelly lawnjelly force-pushed the faster_editor_grid4 branch from f7f01af to e71b3a7 Compare June 13, 2024 10:51
@akien-mga akien-mga merged commit 12eb143 into godotengine:master Aug 16, 2024
16 checks passed
@akien-mga
Copy link
Member

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants