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

[3.x] Optimize String.repeat() #64995

Merged
merged 1 commit into from
Aug 28, 2022

Conversation

Calinou
Copy link
Member

@Calinou Calinou commented Aug 28, 2022

This backports the optimization done in master.

Testing project: test_string_repeat_3.x.zip
Requires readding and exposing a repeat_slow() method with the old code to work.

Benchmark

OS: Fedora 36
CPU: Intel Core i7-6700K @ 4.4 GHz
Compiler: Clang 14.0.5

Performed on an editor debug build, but a release build should also benefit significantly.

Type Before After
len1 x4 5.967ms 5.267ms
len1 x40 17.193ms 5.445ms
len1 x400 126.042ms 5.735ms
len1 x4000 1213.496ms 7.698ms
len5 x4 10.426ms 5.284ms
len5 x40 61.751ms 5.6ms
len5 x400 569.243ms 6.278ms
len45 x4 50.869ms 5.38ms
len45 x40 462.394ms 6.103ms
len250 x4 266.615ms 5.668ms

This backports the optimization done in `master`.

Co-authored-by: VolTer <[email protected]>
@Calinou Calinou requested a review from a team as a code owner August 28, 2022 16:28
@Calinou Calinou added this to the 3.x milestone Aug 28, 2022
@Calinou Calinou changed the title Optimize String.repeat() Optimize String.repeat() (3.x) Aug 28, 2022
@akien-mga akien-mga modified the milestones: 3.x, 3.6 Aug 28, 2022
@akien-mga akien-mga merged commit 2a1403c into godotengine:3.x Aug 28, 2022
@akien-mga
Copy link
Member

Thanks!

@Calinou Calinou deleted the string-optimize-repeat-3.x branch August 29, 2022 13:10
@akien-mga akien-mga changed the title Optimize String.repeat() (3.x) [3.x] Optimize String.repeat() Sep 9, 2024
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.

2 participants