Skip to content

Optimize and simplify sarray#106445

Merged
Repiteo merged 1 commit into
godotengine:masterfrom
YYF233333:opt_sarray
May 26, 2025
Merged

Optimize and simplify sarray#106445
Repiteo merged 1 commit into
godotengine:masterfrom
YYF233333:opt_sarray

Conversation

@YYF233333
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
Contributor

Repiteo commented May 26, 2025

Thanks!

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