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.humanize_size() #84462

Merged
merged 1 commit into from
Jan 4, 2024

Conversation

MewPurPur
Copy link
Contributor

@MewPurPur MewPurPur commented Nov 4, 2023

Might seem like grasping, but this function is actually surprisingly hefty for a String method.

Using this method 1000 times used to take ~3 ms in production builds and ~7.6 ms in unoptimized development builds. Now it's ~1.8 ms in unoptimized development builds.

So this PR seems to make String.humanize_size() 4+ times faster.

Copy link
Member

@akien-mga akien-mga 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 to me.

@akien-mga akien-mga modified the milestones: 4.x, 4.3 Nov 9, 2023
@akien-mga akien-mga changed the title Optimize String.humanize_size() Optimize String.humanize_size() Jan 4, 2024
@akien-mga akien-mga merged commit 5fd5176 into godotengine:master Jan 4, 2024
15 checks passed
@akien-mga
Copy link
Member

Thanks!

@MewPurPur MewPurPur deleted the optimize-humanizesize branch January 4, 2024 13:36
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