Skip to content

Optimize and simplify sarray #106445

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
May 26, 2025
Merged

Optimize and simplify sarray #106445

merged 1 commit into from
May 26, 2025

Conversation

YYF233333
Copy link
Contributor

Make it a one liner as we have std::initializer_list support now, no need for recursion.

@YYF233333 YYF233333 requested a review from a team as a code owner May 15, 2025 14:32
Copy link
Member

@Ivorforce Ivorforce left a comment

Choose a reason for hiding this comment

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

We still have the initializer_list conundrum (godotengine/godot-proposals#12247), but it's probably still faster to use initializer_list here than repeated push_back without chance to reserve.
In either case, sarray is normally used in non bottleneck code, so simplification is welcome.
PS. I've had a look at this code some time as well, and there's a bunch of other functions with the same pattern across the code base. Perhaps you're interested to address these as well.

@Repiteo Repiteo merged commit 81953d3 into godotengine:master May 26, 2025
20 checks passed
@Repiteo
Copy link
Contributor

Repiteo commented May 26, 2025

Thanks!

@YYF233333 YYF233333 deleted the opt_sarray branch May 26, 2025 16: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