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

[Core] Reduce and prevent unnecessary random-access to List #1457

Merged
merged 2 commits into from
May 16, 2024

Conversation

AThousandShips
Copy link
Member

Optionally kept the index operators for compatibility with code using the old syntax, which matters more than in the engine itself, though the conversion is trivial

See:

@AThousandShips AThousandShips added the enhancement This is an enhancement on the current functionality label May 7, 2024
@AThousandShips AThousandShips added this to the 4.3 milestone May 7, 2024
@AThousandShips AThousandShips requested a review from a team as a code owner May 7, 2024 08:47
Random-access access to `List` when iterating is `O(n^2)` (`O(n)` when accessing a single element)

* Removed subscript operator, in favor of a more explicit `get`
* Added conversion from `Iterator` to `ConstIterator`
Copy link
Collaborator

@dsnopek dsnopek left a comment

Choose a reason for hiding this comment

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

Thanks!

The code looks like an exact match to what was merged in Godot (save for the additional of the compatibility operators).

@dsnopek dsnopek merged commit 6b39ed0 into godotengine:master May 16, 2024
12 checks passed
@AThousandShips AThousandShips deleted the foreach_list branch May 16, 2024 13:48
@AThousandShips
Copy link
Member Author

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement This is an enhancement on the current functionality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants