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 String.left() and String.right() #80824

Merged
merged 1 commit into from
Aug 21, 2023

Conversation

MewPurPur
Copy link
Contributor

@MewPurPur MewPurPur commented Aug 20, 2023

Makes these functions ~15% faster. The functions are already extremely fast, but this optimization doesn't do anything super complex, it just bypasses conditions from being unnecessarily checked again in substr() and directly copies data into the new string instead.

@akien-mga akien-mga changed the title Optimize String.left() and String.right() Optimize String.left() and String.right()' Aug 21, 2023
@akien-mga akien-mga changed the title Optimize String.left() and String.right()' Optimize String.left() and String.right() Aug 21, 2023
@akien-mga akien-mga modified the milestones: 4.x, 4.2 Aug 21, 2023
@akien-mga akien-mga merged commit 970be7a into godotengine:master Aug 21, 2023
16 checks passed
@akien-mga
Copy link
Member

Thanks!

@MewPurPur MewPurPur deleted the optimize-left-and-right branch August 21, 2023 07:33
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.

5 participants