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

Add move semantics (constructor, operator=) to List. #100563

Merged
merged 1 commit into from
Dec 20, 2024

Conversation

Ivorforce
Copy link
Contributor

@Ivorforce Ivorforce commented Dec 18, 2024

We've recently begun to introduce move semantics to core, for its performance benefits. Examples of functions that can benefit a lot from move semantics include SWAP (#100367), reduce_at and insert (#100477), and simple data transfer. For more information on motivation, see #100426.

For List, this is especially important because a copy-constructor and copy-assignment are forced to copy the entire array, and all elements in it. And worse, because List is not contiguous, this is slow.

I first wanted to do a use-case analysis like in #100560, but quickly gave up because there were just too many beneficiaries of List move semantics.

@Ivorforce Ivorforce requested a review from a team as a code owner December 18, 2024 15:48
@Chaosus Chaosus added this to the 4.4 milestone Dec 18, 2024
Copy link
Member

@hpvb hpvb left a comment

Choose a reason for hiding this comment

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

LGTM, part of the set of core containers we want to have this property.

@Repiteo Repiteo merged commit 92615f2 into godotengine:master Dec 20, 2024
20 checks passed
@Repiteo
Copy link
Contributor

Repiteo commented Dec 20, 2024

Thanks!

@Ivorforce Ivorforce deleted the move-semantics-list branch December 20, 2024 08:42
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.

6 participants