Skip to content

Optimize GridMap rendering scenario quadruple-getters #105563

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

Merged
merged 1 commit into from
Apr 22, 2025

Conversation

smix8
Copy link
Contributor

@smix8 smix8 commented Apr 19, 2025

Optimizes GridMap rendering scenario quadruple-getters.

While trying to fix #105562 I noticed that GridMap had a really wasteful way of getting the rendering scenario in a few places (or navigation map).

That quadruple getter for the rendering scenario can only be called once per function and outside the loops, instead of x-times. Especially the cell loop could call this a few thousand times for no reason. Also makes the code lines shorter and more readable.

Optimizes GridMap rendering scenario quadruple-getters.
@smix8 smix8 force-pushed the gridmap_get_quadrupled branch from 783513f to 172fbe4 Compare April 19, 2025 11:24
Copy link
Member

@Calinou Calinou left a comment

Choose a reason for hiding this comment

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

Tested locally, it works as expected. Code looks good to me.

@Repiteo Repiteo merged commit 1c51640 into godotengine:master Apr 22, 2025
20 checks passed
@Repiteo
Copy link
Contributor

Repiteo commented Apr 22, 2025

Thanks!

@smix8 smix8 deleted the gridmap_get_quadrupled branch April 22, 2025 20:25
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.

3 participants